Move user settings to new User category for MySQL

This commit is contained in:
nossr50 2019-03-11 23:31:27 -07:00
parent 88cd8e64bb
commit e94005df34
4 changed files with 42 additions and 18 deletions

View File

@ -248,14 +248,14 @@ public class MainConfig extends ConfigValidated {
}
/* MySQL Settings */
for (SQLDatabaseManager.PoolIdentifier identifier : SQLDatabaseManager.PoolIdentifier.values()) {
/*for (SQLDatabaseManager.PoolIdentifier identifier : SQLDatabaseManager.PoolIdentifier.values()) {
if (getMySQLMaxConnections(identifier) <= 0) {
reason.add(MY_SQL + "." + DATABASE + "." + MAX_CONNECTIONS + "." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
}
if (getMySQLMaxPoolSize(identifier) <= 0) {
reason.add(MY_SQL + "." + DATABASE + "." + MAX_POOL_SIZE + "." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
}
}
}*/
/* Mob Healthbar */
if (getMobHealthbarTime() == 0) {
@ -668,7 +668,7 @@ public class MainConfig extends ConfigValidated {
}
/* mySQL */
public boolean getUseMySQL() {
/*public boolean getUseMySQL() {
return getBooleanValue(MY_SQL, ENABLED);
}
@ -706,7 +706,7 @@ public class MainConfig extends ConfigValidated {
public boolean getMySQLSSL() {
return getBooleanValue(MY_SQL, SERVER, SSL);
}
}*/
//TODO: Legit cannot tell what the point of this method was
/*ssadprivate String getStringIncludingInts(String[] key) {

View File

@ -6,12 +6,6 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigCategoryDatabase {
@Setting(value = "User_Name", comment = "The authorized user for your MySQL/MariaDB DB")
private String username = "example_user_name";
@Setting(value = "User_Password", comment = "The password for your authorized user")
private String password = "example_user_password";
@Setting(value = "Database_Name", comment = "The database name for your DB, this DB must already exist on the SQL server.")
private String databaseName = "example_database_name";
@ -28,14 +22,6 @@ public class ConfigCategoryDatabase {
* GETTER BOILERPLATE
*/
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getDatabaseName() {
return databaseName;
}

View File

@ -9,9 +9,15 @@ public class ConfigCategoryMySQL {
@Setting(value = "Enabled", comment = "If set to true, mcMMO will use MySQL/MariaDB instead of FlatFile storage")
private boolean enabled = true;
@Setting(value = "User", comment = "Your MySQL User Settings")
private ConfigCategoryUser configCategoryUser;
@Setting(value = "Database", comment = "Database settings for MySQL/MariaDB")
private ConfigCategoryDatabase configCategoryDatabase;
@Setting(value = "Server", comment = "Your MySQL/MariaDB server settings.")
private ConfigCategoryServer configCategoryServer;
/*
* GETTER BOILERPLATE
*/
@ -23,4 +29,8 @@ public class ConfigCategoryMySQL {
public ConfigCategoryDatabase getConfigCategoryDatabase() {
return configCategoryDatabase;
}
public ConfigCategoryServer getConfigCategoryServer() {
return configCategoryServer;
}
}

View File

@ -0,0 +1,28 @@
package com.gmail.nossr50.config.hocon.database;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigCategoryUser {
@Setting(value = "User_Name", comment = "The authorized user for your MySQL/MariaDB DB")
private String username = "example_user_name";
@Setting(value = "User_Password", comment = "The password for your authorized user")
private String password = "example_user_password";
/*
* GETTER BOILERPLATE
*/
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
}