forked from public-mirrors/HuskSync
Refactor name to be HuskSync
parent
520f1ea1d7
commit
f842afac1e
@ -1,20 +1,20 @@
|
||||
# CrossServerSync
|
||||
**CrossServerSync** is a robust solution for synchronising player data (inventories, health, hunger & status effects) between servers. It was designed as a much faster alternative to MySQLPlayerDataBridge,
|
||||
# HuskSync
|
||||
**HuskSync** is a robust solution for synchronising player data (inventories, health, hunger & status effects) between servers. It was designed as a much faster alternative to MySQLPlayerDataBridge,
|
||||
|
||||
### Installation
|
||||
Install CrossServerSync in the `/plugins/` folder of your Spigot (and derivatives) servers and Proxy (BungeeCord and derivatives) server.
|
||||
## Installation
|
||||
Install HuskSync in the `/plugins/` folder of your Spigot (and derivatives) servers and Proxy (BungeeCord and derivatives) server.
|
||||
Start your servers, then stop them again to allow the configuration files to generate.
|
||||
|
||||
Navigate to the generated config.yml files on your Spigot server and Proxy (located in `/plugins/CrossServerSync/`) and fill in the credentials of your redis server. On the Proxy server, you can additionally configure a MySQL database to save player data in, as by default the plugin will create a SQLite database for this.
|
||||
Navigate to the generated config.yml files on your Spigot server and Proxy (located in `/plugins/HuskSync/`) and fill in the credentials of your redis server. On the Proxy server, you can additionally configure a MySQL database to save player data in, as by default the plugin will create a SQLite database for this.
|
||||
|
||||
If you have multiple proxy servers (i.e. via RedisBungee), you need to install the plugin on all of them and make use of the MySQL option and ensure the proxies are using the same database.
|
||||
|
||||
### How it works
|
||||
## How it works
|
||||
![Flow chart showing different processes of how the plugin works](images/flow-chart.png)
|
||||
CrossServerSync synchronises player data between servers using Redis to transfer cached data, loaded from a central database as necessary.
|
||||
HuskSync synchronises player data between servers using Redis to transfer cached data, loaded from a central database as necessary.
|
||||
|
||||
### Building
|
||||
To build CrossServerSync, run the following in the root of the repository:
|
||||
## Building
|
||||
To build HuskSync, run the following in the root of the repository:
|
||||
```
|
||||
./gradlew clean build
|
||||
```
|
@ -1,6 +1,6 @@
|
||||
package me.william278.crossserversync.bukkit.config;
|
||||
package me.william278.husksync.bukkit.config;
|
||||
|
||||
import me.william278.crossserversync.Settings;
|
||||
import me.william278.husksync.Settings;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
public class ConfigLoader {
|
@ -1,34 +1,19 @@
|
||||
package me.william278.crossserversync.bukkit.data;
|
||||
package me.william278.husksync.bukkit.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitDataCache {
|
||||
|
||||
/**
|
||||
* Map of Player UUIDs to last-updated PlayerData version UUIDs
|
||||
*/
|
||||
private static HashMap<UUID, UUID> bukkitDataCache;
|
||||
|
||||
/**
|
||||
* Map of Player UUIDs to request on join
|
||||
*/
|
||||
private static HashSet<UUID> requestOnJoin;
|
||||
|
||||
public BukkitDataCache() {
|
||||
bukkitDataCache = new HashMap<>();
|
||||
requestOnJoin = new HashSet<>();
|
||||
}
|
||||
|
||||
public UUID getVersionUUID(UUID playerUUID) {
|
||||
return bukkitDataCache.get(playerUUID);
|
||||
}
|
||||
|
||||
public void setVersionUUID(UUID playerUUID, UUID dataVersionUUID) {
|
||||
bukkitDataCache.put(playerUUID, dataVersionUUID);
|
||||
}
|
||||
|
||||
public boolean isPlayerRequestingOnJoin(UUID uuid) {
|
||||
return requestOnJoin.contains(uuid);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package me.william278.crossserversync.bungeecord.data.sql;
|
||||
|
||||
import me.william278.crossserversync.Settings;
|
||||
import me.william278.crossserversync.CrossServerSyncBungeeCord;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public abstract class Database {
|
||||
protected CrossServerSyncBungeeCord plugin;
|
||||
|
||||
public final static String DATA_POOL_NAME = "CrossServerSyncHikariPool";
|
||||
public final static String PLAYER_TABLE_NAME = "crossserversync_players";
|
||||
public final static String DATA_TABLE_NAME = "crossserversync_data";
|
||||
|
||||
public Database(CrossServerSyncBungeeCord instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
public abstract Connection getConnection() throws SQLException;
|
||||
|
||||
public abstract void load();
|
||||
|
||||
public abstract void backup();
|
||||
|
||||
public abstract void close();
|
||||
|
||||
public final int hikariMaximumPoolSize = Settings.hikariMaximumPoolSize;
|
||||
public final int hikariMinimumIdle = Settings.hikariMinimumIdle;
|
||||
public final long hikariMaximumLifetime = Settings.hikariMaximumLifetime;
|
||||
public final long hikariKeepAliveTime = Settings.hikariKeepAliveTime;
|
||||
public final long hikariConnectionTimeOut = Settings.hikariConnectionTimeOut;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package me.william278.husksync.bungeecord.data.sql;
|
||||
|
||||
import me.william278.husksync.HuskSyncBungeeCord;
|
||||
import me.william278.husksync.Settings;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public abstract class Database {
|
||||
protected HuskSyncBungeeCord plugin;
|
||||
|
||||
public final static String DATA_POOL_NAME = "HuskSyncHikariPool";
|
||||
public final static String PLAYER_TABLE_NAME = "husksync_players";
|
||||
public final static String DATA_TABLE_NAME = "husksync_data";
|
||||
|
||||
public Database(HuskSyncBungeeCord instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
public abstract Connection getConnection() throws SQLException;
|
||||
|
||||
public abstract void load();
|
||||
|
||||
public abstract void backup();
|
||||
|
||||
public abstract void close();
|
||||
|
||||
public final int hikariMaximumPoolSize = me.william278.husksync.Settings.hikariMaximumPoolSize;
|
||||
public final int hikariMinimumIdle = me.william278.husksync.Settings.hikariMinimumIdle;
|
||||
public final long hikariMaximumLifetime = me.william278.husksync.Settings.hikariMaximumLifetime;
|
||||
public final long hikariKeepAliveTime = me.william278.husksync.Settings.hikariKeepAliveTime;
|
||||
public final long hikariConnectionTimeOut = Settings.hikariConnectionTimeOut;
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package me.william278.crossserversync;
|
||||
package me.william278.husksync;
|
||||
|
||||
public class MessageStrings {
|
||||
|
||||
public static final StringBuilder PLUGIN_INFORMATION = new StringBuilder().append("[CrossServerSync](#00fb9a bold) [| %proxy_brand% Version %proxy_version% (%bukkit_brand% v%bukkit_version%)](#00fb9a)\n")
|
||||
public static final StringBuilder PLUGIN_INFORMATION = new StringBuilder().append("[HuskSync](#00fb9a bold) [| %proxy_brand% Version %proxy_version% (%bukkit_brand% v%bukkit_version%)](#00fb9a)\n")
|
||||
.append("[%plugin_description%](gray)\n")
|
||||
.append("[• Author:](white) [William278](gray show_text=&7Click to pay a visit open_url=https://youtube.com/William27528)\n")
|
||||
.append("[• Help Wiki:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/CrossServerSync/wiki/)\n")
|
||||
.append("[• Report Issues:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/CrossServerSync/issues)\n")
|
||||
.append("[• Help Wiki:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/HuskSync/wiki/)\n")
|
||||
.append("[• Report Issues:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/HuskSync/issues)\n")
|
||||
.append("[• Support Discord:](white) [[Link]](#00fb9a show_text=&7Click to join open_url=https://discord.gg/tVYhJfyDWG)");
|
||||
|
||||
public static final String ERROR_INVALID_SYNTAX = "[Error:](#ff3300) [Incorrect syntax. Usage: %1%](#ff7e5e)";
|
@ -1,4 +1,4 @@
|
||||
package me.william278.crossserversync;
|
||||
package me.william278.husksync;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.UUID;
|
@ -1,5 +1,8 @@
|
||||
package me.william278.crossserversync;
|
||||
package me.william278.husksync;
|
||||
|
||||
/**
|
||||
* Settings class, holds values loaded from the plugin config (either Bukkit or Bungee)
|
||||
*/
|
||||
public class Settings {
|
||||
|
||||
/*
|
@ -1,6 +1,6 @@
|
||||
name: CrossServerSync
|
||||
version: @version@
|
||||
main: me.william278.crossserversync.CrossServerSyncBukkit
|
||||
main: me.william278.husksync.HuskSyncBukkit
|
||||
api-version: 1.16
|
||||
author: William278
|
||||
description: 'Synchronize data cross-server'
|
Loading…
Reference in New Issue