From e94005df345f0ea2d87dabe97346a3ec26635046 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 11 Mar 2019 23:31:27 -0700 Subject: [PATCH] Move user settings to new User category for MySQL --- .../com/gmail/nossr50/config/MainConfig.java | 8 +++--- .../database/ConfigCategoryDatabase.java | 14 ---------- .../hocon/database/ConfigCategoryMySQL.java | 10 +++++++ .../hocon/database/ConfigCategoryUser.java | 28 +++++++++++++++++++ 4 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryUser.java diff --git a/src/main/java/com/gmail/nossr50/config/MainConfig.java b/src/main/java/com/gmail/nossr50/config/MainConfig.java index e861119db..eb677f2fa 100644 --- a/src/main/java/com/gmail/nossr50/config/MainConfig.java +++ b/src/main/java/com/gmail/nossr50/config/MainConfig.java @@ -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) { diff --git a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryDatabase.java b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryDatabase.java index 56c2d0f6d..1b6b3ea80 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryDatabase.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryDatabase.java @@ -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; } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMySQL.java b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMySQL.java index 505580e13..aebf84241 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMySQL.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMySQL.java @@ -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; + } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryUser.java b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryUser.java new file mode 100644 index 000000000..149fbd8e1 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryUser.java @@ -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; + } + + +}