mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-31 11:35:28 +02:00
Fixed the loading of the Serialized configs
This commit is contained in:
@@ -1,45 +1,17 @@
|
||||
package com.gmail.nossr50.config.hocon.database;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.ConfigConstants;
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
|
||||
@ConfigSerializable
|
||||
public class ConfigDatabase extends Config {
|
||||
|
||||
public ConfigDatabase() {
|
||||
super("mysql", ConfigConstants.getDataFolder(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR,
|
||||
true,true, false, true);
|
||||
|
||||
initFullConfig(); //Load Config
|
||||
}
|
||||
public class ConfigDatabase {
|
||||
|
||||
/*
|
||||
* CONFIG NODES
|
||||
*/
|
||||
|
||||
@Setting(value = "MySQL", comment = "Settings for using MySQL or MariaDB database")
|
||||
private UserConfigSectionMySQL userConfigSectionMySQL;
|
||||
|
||||
/*
|
||||
* CLASS OVERRIDES
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of this config
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public double getConfigVersion() {
|
||||
return 1;
|
||||
}
|
||||
private UserConfigSectionMySQL userConfigSectionMySQL = new UserConfigSectionMySQL();
|
||||
|
||||
/*
|
||||
* GETTER BOILERPLATE
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.config.hocon.database;
|
||||
|
||||
import com.gmail.nossr50.config.hocon.ConfigSection;
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
|
||||
@@ -13,8 +12,6 @@ public class UserConfigSectionDatabase {
|
||||
@Setting(value = "Table_Prefix", comment = "The Prefix that will be used for tables in your DB")
|
||||
private String tablePrefix = "mcmmo_";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* GETTER BOILERPLATE
|
||||
*/
|
||||
|
@@ -11,13 +11,13 @@ public class UserConfigSectionMySQL {
|
||||
private boolean enabled = true;
|
||||
|
||||
@Setting(value = "User", comment = "Your MySQL User Settings")
|
||||
private UserConfigSectionUser userConfigSectionUser;
|
||||
private UserConfigSectionUser userConfigSectionUser = new UserConfigSectionUser();
|
||||
|
||||
@Setting(value = "Database", comment = "Database settings for MySQL/MariaDB")
|
||||
private UserConfigSectionDatabase userConfigSectionDatabase;
|
||||
private UserConfigSectionDatabase userConfigSectionDatabase = new UserConfigSectionDatabase();
|
||||
|
||||
@Setting(value = "Server", comment = "Your MySQL/MariaDB server settings.")
|
||||
private UserConfigSectionServer userConfigSectionServer;
|
||||
private UserConfigSectionServer userConfigSectionServer = new UserConfigSectionServer();
|
||||
|
||||
/*
|
||||
* GETTER BOILERPLATE
|
||||
@@ -59,11 +59,11 @@ public class UserConfigSectionMySQL {
|
||||
switch (poolIdentifier)
|
||||
{
|
||||
case LOAD:
|
||||
return userConfigSectionServer.getUserConfigSectionMaxPoolSize().getLoad();
|
||||
return userConfigSectionServer.getUserConfigSectionMaxConnections().getLoad();
|
||||
case SAVE:
|
||||
return userConfigSectionServer.getUserConfigSectionMaxPoolSize().getSave();
|
||||
return userConfigSectionServer.getUserConfigSectionMaxConnections().getSave();
|
||||
case MISC:
|
||||
return userConfigSectionServer.getUserConfigSectionMaxPoolSize().getMisc();
|
||||
return userConfigSectionServer.getUserConfigSectionMaxConnections().getMisc();
|
||||
default:
|
||||
return 20;
|
||||
}
|
||||
|
@@ -6,22 +6,25 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
@ConfigSerializable
|
||||
public class UserConfigSectionServer {
|
||||
|
||||
@Setting(value = "Use_SSL", comment = "Enables SSL for MySQL/MariaDB connections, newer versions of MySQL will spam your console if you aren't using SSL." +
|
||||
" It is recommended that you turn this on if you are using a newer version of MySQL," +
|
||||
" if you run into issues with SSL not being supported, turn this off.")
|
||||
@Setting(value = "Use_SSL", comment = "Enables SSL for MySQL/MariaDB connections." +
|
||||
"\nIf your SQL server supports SSL, it is recommended to have it on but not necessary." +
|
||||
"\nIf you run into any issues involving SSL, its best to just turn this off.")
|
||||
private boolean useSSL = true;
|
||||
|
||||
@Setting(value = "Server_Port", comment = "Your MySQL/MariaDB server port")
|
||||
@Setting(value = "Server_Port", comment = "Your MySQL/MariaDB server port" +
|
||||
"\nThe default port is typically 3306 for MySQL, but every server configuration is different!")
|
||||
private int serverPort = 3306;
|
||||
|
||||
@Setting(value = "Server_Address", comment = "The address for your MySQL/MariaDB server")
|
||||
@Setting(value = "Server_Address", comment = "The address for your MySQL/MariaDB server" +
|
||||
"If the MySQL server is hosted on the same machine, you can use the localhost alias")
|
||||
private String serverAddress = "localhost";
|
||||
|
||||
@Setting(value = "Max_Connections", comment = "This setting is the max simultaneous MySQL/MariaDB connections allowed at a time, this needs to be high enough to support multiple player logins in quick succession")
|
||||
private UserConfigSectionMaxConnections userConfigSectionMaxConnections;
|
||||
@Setting(value = "Max_Connections", comment = "This setting is the max simultaneous MySQL/MariaDB connections allowed at a time." +
|
||||
"\nThis needs to be high enough to support multiple player logins in quick succession, it is recommended that you do not lower these values")
|
||||
private UserConfigSectionMaxConnections userConfigSectionMaxConnections = new UserConfigSectionMaxConnections();
|
||||
|
||||
@Setting(value = "Max_Pool_Size", comment = "This setting is the max size of the pool of cached connections that we hold at any given time.")
|
||||
private UserConfigSectionMaxPoolSize userConfigSectionMaxPoolSize;
|
||||
private UserConfigSectionMaxPoolSize userConfigSectionMaxPoolSize = new UserConfigSectionMaxPoolSize();
|
||||
|
||||
/*
|
||||
* GETTER BOILERPLATE
|
||||
|
Reference in New Issue
Block a user