From 88cd8e64bb5b7a3291f1ec60c3b9f06d412725c0 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 11 Mar 2019 23:11:56 -0700 Subject: [PATCH] Database Config getter boilerplate --- .../commands/skills/SmeltingCommand.java | 1 - .../com/gmail/nossr50/config/MainConfig.java | 4 --- .../database/ConfigCategoryDatabase.java | 28 +++++++++++++++++++ .../ConfigCategoryMaxConnections.java | 15 ++++++++++ .../database/ConfigCategoryMaxPoolSize.java | 16 +++++++++++ .../hocon/database/ConfigCategoryMySQL.java | 10 +++++++ .../hocon/database/ConfigCategoryServer.java | 16 +++++++++++ .../config/hocon/database/ConfigDatabase.java | 8 ++++++ .../superabilities/ConfigSuperAbilities.java | 8 ++++++ src/main/resources/config.yml | 6 ---- 10 files changed, 101 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/superabilities/ConfigSuperAbilities.java diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java index 6c6b8da6b..b688691c6 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.commands.skills; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; diff --git a/src/main/java/com/gmail/nossr50/config/MainConfig.java b/src/main/java/com/gmail/nossr50/config/MainConfig.java index f1775d414..e861119db 100644 --- a/src/main/java/com/gmail/nossr50/config/MainConfig.java +++ b/src/main/java/com/gmail/nossr50/config/MainConfig.java @@ -939,10 +939,6 @@ public class MainConfig extends ConfigValidated { return getBooleanValue(ABILITIES, ACTIVATION, ONLY_ACTIVATE_WHEN_SNEAKING); } - public boolean getAbilitiesGateEnabled() { - return getBooleanValue(ABILITIES, ACTIVATION, LEVEL_GATE_ABILITIES); - } - public int getCooldown(SuperAbilityType ability) { return getIntValue(ABILITIES, COOLDOWNS + ability.toString()); } 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 cd6a3671f..56c2d0f6d 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 @@ -23,4 +23,32 @@ public class ConfigCategoryDatabase { @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 ConfigCategoryMaxPoolSize configCategoryMaxPoolSize; + + /* + * GETTER BOILERPLATE + */ + + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + + public String getDatabaseName() { + return databaseName; + } + + public String getTablePrefix() { + return tablePrefix; + } + + public ConfigCategoryMaxConnections getConfigCategoryMaxConnections() { + return configCategoryMaxConnections; + } + + public ConfigCategoryMaxPoolSize getConfigCategoryMaxPoolSize() { + return configCategoryMaxPoolSize; + } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMaxConnections.java b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMaxConnections.java index d1106199c..a85202ea6 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMaxConnections.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMaxConnections.java @@ -15,4 +15,19 @@ public class ConfigCategoryMaxConnections { @Setting(value = "Save") private int save = 30; + /* + * GETTER BOILERPLATE + */ + + public int getMisc() { + return misc; + } + + public int getLoad() { + return load; + } + + public int getSave() { + return save; + } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMaxPoolSize.java b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMaxPoolSize.java index b8efc7862..66db2ce17 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMaxPoolSize.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMaxPoolSize.java @@ -13,4 +13,20 @@ public class ConfigCategoryMaxPoolSize { @Setting(value = "Save") private int save = 20; + + /* + * GETTER BOILERPLATE + */ + + public int getMisc() { + return misc; + } + + public int getLoad() { + return load; + } + + public int getSave() { + return save; + } } 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 4242cd685..505580e13 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 @@ -12,5 +12,15 @@ public class ConfigCategoryMySQL { @Setting(value = "Database", comment = "Database settings for MySQL/MariaDB") private ConfigCategoryDatabase configCategoryDatabase; + /* + * GETTER BOILERPLATE + */ + public boolean isMySQLEnabled() { + return enabled; + } + + public ConfigCategoryDatabase getConfigCategoryDatabase() { + return configCategoryDatabase; + } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryServer.java b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryServer.java index c530824d0..c3ac7de5d 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryServer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryServer.java @@ -16,4 +16,20 @@ public class ConfigCategoryServer { @Setting(value = "Server_Address", comment = "The address for your MySQL/MariaDB server") private String serverAddress = "localhost"; + + /* + * GETTER BOILERPLATE + */ + + public boolean isUseSSL() { + return useSSL; + } + + public int getServerPort() { + return serverPort; + } + + public String getServerAddress() { + return serverAddress; + } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigDatabase.java b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigDatabase.java index 66fdd6a93..1e6d6fcbc 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigDatabase.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigDatabase.java @@ -32,4 +32,12 @@ public class ConfigDatabase extends Config { public double getConfigVersion() { return 1; } + + /* + * GETTER BOILERPLATE + */ + + public ConfigCategoryMySQL getConfigCategoryMySQL() { + return configCategoryMySQL; + } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/superabilities/ConfigSuperAbilities.java b/src/main/java/com/gmail/nossr50/config/hocon/superabilities/ConfigSuperAbilities.java new file mode 100644 index 000000000..098bd6af4 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/superabilities/ConfigSuperAbilities.java @@ -0,0 +1,8 @@ +package com.gmail.nossr50.config.hocon.superabilities; + +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigSuperAbilities { + +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 2b7522312..074743e17 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -332,10 +332,8 @@ Skills: Enabled_For_PVP: true Enabled_For_PVE: true Level_Cap: 0 - Ability_Activation_Level_Gate: 10 Excavation: Level_Cap: 0 - Ability_Activation_Level_Gate: 10 Fishing: Level_Cap: 0 Drops_Enabled: true @@ -349,7 +347,6 @@ Skills: Mining: Level_Cap: 0 Detonator_Name: FLINT_AND_STEEL - Ability_Activation_Level_Gate: 10 Repair: Level_Cap: 0 Anvil_Messages: true @@ -372,7 +369,6 @@ Skills: Enabled_For_PVP: true Enabled_For_PVE: true Level_Cap: 0 - Ability_Activation_Level_Gate: 10 Taming: Enabled_For_PVP: true Enabled_For_PVE: true @@ -409,7 +405,6 @@ Skills: Enabled_For_PVP: true Enabled_For_PVE: true Level_Cap: 0 - Ability_Activation_Level_Gate: 10 Block_Cracker: SmoothBrick_To_CrackedBrick: true # When using Unarmed, picked up items will automatically get moved to a free slot instead of going in the slot @@ -420,7 +415,6 @@ Skills: Woodcutting: Tree_Feller_Sounds: true Level_Cap: 0 - Ability_Activation_Level_Gate: 10 # # Settings for Double Drops