|
|
@ -20,117 +20,255 @@ import java.util.Map;
|
|
|
|
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
|
|
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
|
|
┣╸ Information: https://william278.net/project/husksync
|
|
|
|
┣╸ Information: https://william278.net/project/husksync
|
|
|
|
┗╸ Documentation: https://william278.net/docs/husksync""",
|
|
|
|
┗╸ Documentation: https://william278.net/docs/husksync""",
|
|
|
|
versionField = "config_version", versionNumber = 3)
|
|
|
|
versionField = "config_version", versionNumber = 4)
|
|
|
|
public class Settings {
|
|
|
|
public class Settings {
|
|
|
|
|
|
|
|
|
|
|
|
// Top-level settings
|
|
|
|
// Top-level settings
|
|
|
|
public String language = "en-gb";
|
|
|
|
@YamlKey("language")
|
|
|
|
|
|
|
|
private String language = "en-gb";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("check_for_updates")
|
|
|
|
@YamlKey("check_for_updates")
|
|
|
|
public boolean checkForUpdates = true;
|
|
|
|
private boolean checkForUpdates = true;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("cluster_id")
|
|
|
|
@YamlKey("cluster_id")
|
|
|
|
public String clusterId = "";
|
|
|
|
private String clusterId = "";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("debug_logging")
|
|
|
|
@YamlKey("debug_logging")
|
|
|
|
public boolean debugLogging = false;
|
|
|
|
private boolean debugLogging = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Database settings
|
|
|
|
// Database settings
|
|
|
|
@YamlComment("Database connection settings")
|
|
|
|
@YamlComment("Database connection settings")
|
|
|
|
@YamlKey("database.credentials.host")
|
|
|
|
@YamlKey("database.credentials.host")
|
|
|
|
public String mySqlHost = "localhost";
|
|
|
|
private String mySqlHost = "localhost";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.credentials.port")
|
|
|
|
@YamlKey("database.credentials.port")
|
|
|
|
public int mySqlPort = 3306;
|
|
|
|
private int mySqlPort = 3306;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.credentials.database")
|
|
|
|
@YamlKey("database.credentials.database")
|
|
|
|
public String mySqlDatabase = "HuskSync";
|
|
|
|
private String mySqlDatabase = "HuskSync";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.credentials.username")
|
|
|
|
@YamlKey("database.credentials.username")
|
|
|
|
public String mySqlUsername = "root";
|
|
|
|
private String mySqlUsername = "root";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.credentials.password")
|
|
|
|
@YamlKey("database.credentials.password")
|
|
|
|
public String mySqlPassword = "pa55w0rd";
|
|
|
|
private String mySqlPassword = "pa55w0rd";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.credentials.parameters")
|
|
|
|
@YamlKey("database.credentials.parameters")
|
|
|
|
public String mySqlConnectionParameters = "?autoReconnect=true&useSSL=false";
|
|
|
|
private String mySqlConnectionParameters = "?autoReconnect=true&useSSL=false";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlComment("MySQL connection pool properties")
|
|
|
|
@YamlComment("MySQL connection pool properties")
|
|
|
|
@YamlKey("database.connection_pool.maximum_pool_size")
|
|
|
|
@YamlKey("database.connection_pool.maximum_pool_size")
|
|
|
|
public int mySqlConnectionPoolSize = 10;
|
|
|
|
private int mySqlConnectionPoolSize = 10;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.connection_pool.minimum_idle")
|
|
|
|
@YamlKey("database.connection_pool.minimum_idle")
|
|
|
|
public int mySqlConnectionPoolIdle = 10;
|
|
|
|
private int mySqlConnectionPoolIdle = 10;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.connection_pool.maximum_lifetime")
|
|
|
|
@YamlKey("database.connection_pool.maximum_lifetime")
|
|
|
|
public long mySqlConnectionPoolLifetime = 1800000;
|
|
|
|
private long mySqlConnectionPoolLifetime = 1800000;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.connection_pool.keepalive_time")
|
|
|
|
@YamlKey("database.connection_pool.keepalive_time")
|
|
|
|
public long mySqlConnectionPoolKeepAlive = 0;
|
|
|
|
private long mySqlConnectionPoolKeepAlive = 0;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.connection_pool.connection_timeout")
|
|
|
|
@YamlKey("database.connection_pool.connection_timeout")
|
|
|
|
public long mySqlConnectionPoolTimeout = 5000;
|
|
|
|
private long mySqlConnectionPoolTimeout = 5000;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("database.table_names")
|
|
|
|
@YamlKey("database.table_names")
|
|
|
|
public Map<String, String> tableNames = TableName.getDefaults();
|
|
|
|
private Map<String, String> tableNames = TableName.getDefaults();
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getTableName(@NotNull TableName tableName) {
|
|
|
|
|
|
|
|
return tableNames.getOrDefault(tableName.name().toLowerCase(), tableName.defaultName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Redis settings
|
|
|
|
// Redis settings
|
|
|
|
@YamlComment("Redis connection settings")
|
|
|
|
@YamlComment("Redis connection settings")
|
|
|
|
@YamlKey("redis.credentials.host")
|
|
|
|
@YamlKey("redis.credentials.host")
|
|
|
|
public String redisHost = "localhost";
|
|
|
|
private String redisHost = "localhost";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("redis.credentials.port")
|
|
|
|
@YamlKey("redis.credentials.port")
|
|
|
|
public int redisPort = 6379;
|
|
|
|
private int redisPort = 6379;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("redis.credentials.password")
|
|
|
|
@YamlKey("redis.credentials.password")
|
|
|
|
public String redisPassword = "";
|
|
|
|
private String redisPassword = "";
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("redis.use_ssl")
|
|
|
|
@YamlKey("redis.use_ssl")
|
|
|
|
public boolean redisUseSsl = false;
|
|
|
|
private boolean redisUseSsl = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Synchronization settings
|
|
|
|
// Synchronization settings
|
|
|
|
@YamlComment("Synchronization settings")
|
|
|
|
@YamlComment("Synchronization settings")
|
|
|
|
@YamlKey("synchronization.max_user_data_snapshots")
|
|
|
|
@YamlKey("synchronization.max_user_data_snapshots")
|
|
|
|
public int maxUserDataSnapshots = 5;
|
|
|
|
private int maxUserDataSnapshots = 5;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.save_on_world_save")
|
|
|
|
@YamlKey("synchronization.save_on_world_save")
|
|
|
|
public boolean saveOnWorldSave = true;
|
|
|
|
private boolean saveOnWorldSave = true;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.save_on_death")
|
|
|
|
@YamlKey("synchronization.save_on_death")
|
|
|
|
public boolean saveOnDeath = false;
|
|
|
|
private boolean saveOnDeath = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.save_empty_drops_on_death")
|
|
|
|
|
|
|
|
private boolean saveEmptyDropsOnDeath = true;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.compress_data")
|
|
|
|
@YamlKey("synchronization.compress_data")
|
|
|
|
public boolean compressData = true;
|
|
|
|
private boolean compressData = true;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.notification_display_slot")
|
|
|
|
@YamlKey("synchronization.notification_display_slot")
|
|
|
|
public NotificationDisplaySlot notificationDisplaySlot = NotificationDisplaySlot.ACTION_BAR;
|
|
|
|
private NotificationDisplaySlot notificationDisplaySlot = NotificationDisplaySlot.ACTION_BAR;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.save_dead_player_inventories")
|
|
|
|
@YamlKey("synchronization.synchronise_dead_players_changing_server")
|
|
|
|
public boolean saveDeadPlayerInventories = true;
|
|
|
|
private boolean synchroniseDeadPlayersChangingServer = true;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.network_latency_milliseconds")
|
|
|
|
@YamlKey("synchronization.network_latency_milliseconds")
|
|
|
|
public int networkLatencyMilliseconds = 500;
|
|
|
|
private int networkLatencyMilliseconds = 500;
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.features")
|
|
|
|
@YamlKey("synchronization.features")
|
|
|
|
public Map<String, Boolean> synchronizationFeatures = SynchronizationFeature.getDefaults();
|
|
|
|
private Map<String, Boolean> synchronizationFeatures = SynchronizationFeature.getDefaults();
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.blacklisted_commands_while_locked")
|
|
|
|
@YamlKey("synchronization.blacklisted_commands_while_locked")
|
|
|
|
public List<String> blacklistedCommandsWhileLocked = new ArrayList<>();
|
|
|
|
private List<String> blacklistedCommandsWhileLocked = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.event_priorities")
|
|
|
|
|
|
|
|
private Map<String, String> synchronizationEventPriorities = EventType.getDefaults();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Zero-args constructor for instantiation via Annotaml
|
|
|
|
|
|
|
|
public Settings() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getLanguage() {
|
|
|
|
|
|
|
|
return language;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean doCheckForUpdates() {
|
|
|
|
|
|
|
|
return checkForUpdates;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getClusterId() {
|
|
|
|
|
|
|
|
return clusterId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean doDebugLogging() {
|
|
|
|
|
|
|
|
return debugLogging;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getMySqlHost() {
|
|
|
|
|
|
|
|
return mySqlHost;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getMySqlPort() {
|
|
|
|
|
|
|
|
return mySqlPort;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getMySqlDatabase() {
|
|
|
|
|
|
|
|
return mySqlDatabase;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getMySqlUsername() {
|
|
|
|
|
|
|
|
return mySqlUsername;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getMySqlPassword() {
|
|
|
|
|
|
|
|
return mySqlPassword;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getMySqlConnectionParameters() {
|
|
|
|
|
|
|
|
return mySqlConnectionParameters;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getTableName(@NotNull TableName tableName) {
|
|
|
|
|
|
|
|
return tableNames.getOrDefault(tableName.name().toLowerCase(), tableName.defaultName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getMySqlConnectionPoolSize() {
|
|
|
|
|
|
|
|
return mySqlConnectionPoolSize;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getMySqlConnectionPoolIdle() {
|
|
|
|
|
|
|
|
return mySqlConnectionPoolIdle;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public long getMySqlConnectionPoolLifetime() {
|
|
|
|
|
|
|
|
return mySqlConnectionPoolLifetime;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public long getMySqlConnectionPoolKeepAlive() {
|
|
|
|
|
|
|
|
return mySqlConnectionPoolKeepAlive;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public long getMySqlConnectionPoolTimeout() {
|
|
|
|
|
|
|
|
return mySqlConnectionPoolTimeout;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getRedisHost() {
|
|
|
|
|
|
|
|
return redisHost;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getRedisPort() {
|
|
|
|
|
|
|
|
return redisPort;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public String getRedisPassword() {
|
|
|
|
|
|
|
|
return redisPassword;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isRedisUseSsl() {
|
|
|
|
|
|
|
|
return redisUseSsl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getMaxUserDataSnapshots() {
|
|
|
|
|
|
|
|
return maxUserDataSnapshots;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean doSaveOnWorldSave() {
|
|
|
|
|
|
|
|
return saveOnWorldSave;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean doSaveOnDeath() {
|
|
|
|
|
|
|
|
return saveOnDeath;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean doSaveEmptyDropsOnDeath() {
|
|
|
|
|
|
|
|
return saveEmptyDropsOnDeath;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean doCompressData() {
|
|
|
|
|
|
|
|
return compressData;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public NotificationDisplaySlot getNotificationDisplaySlot() {
|
|
|
|
|
|
|
|
return notificationDisplaySlot;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isSynchroniseDeadPlayersChangingServer() {
|
|
|
|
|
|
|
|
return synchroniseDeadPlayersChangingServer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getNetworkLatencyMilliseconds() {
|
|
|
|
|
|
|
|
return networkLatencyMilliseconds;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public Map<String, Boolean> getSynchronizationFeatures() {
|
|
|
|
|
|
|
|
return synchronizationFeatures;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean getSynchronizationFeature(@NotNull SynchronizationFeature feature) {
|
|
|
|
public boolean getSynchronizationFeature(@NotNull SynchronizationFeature feature) {
|
|
|
|
return synchronizationFeatures.getOrDefault(feature.name().toLowerCase(), feature.enabledByDefault);
|
|
|
|
return getSynchronizationFeatures().getOrDefault(feature.name().toLowerCase(), feature.enabledByDefault);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@YamlKey("synchronization.event_priorities")
|
|
|
|
@NotNull
|
|
|
|
public Map<String, String> synchronizationEventPriorities = EventType.getDefaults();
|
|
|
|
public List<String> getBlacklistedCommandsWhileLocked() {
|
|
|
|
|
|
|
|
return blacklistedCommandsWhileLocked;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
@NotNull
|
|
|
|
public EventPriority getEventPriority(@NotNull Settings.EventType eventType) {
|
|
|
|
public EventPriority getEventPriority(@NotNull Settings.EventType eventType) {
|
|
|
@ -142,7 +280,6 @@ public class Settings {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Represents the names of tables in the database
|
|
|
|
* Represents the names of tables in the database
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|