mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Database Config getter boilerplate
This commit is contained in:
		@@ -1,6 +1,5 @@
 | 
				
			|||||||
package com.gmail.nossr50.commands.skills;
 | 
					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.PrimarySkillType;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
 | 
					import com.gmail.nossr50.datatypes.skills.SubSkillType;
 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -939,10 +939,6 @@ public class MainConfig extends ConfigValidated {
 | 
				
			|||||||
        return getBooleanValue(ABILITIES, ACTIVATION, ONLY_ACTIVATE_WHEN_SNEAKING);
 | 
					        return getBooleanValue(ABILITIES, ACTIVATION, ONLY_ACTIVATE_WHEN_SNEAKING);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean getAbilitiesGateEnabled() {
 | 
					 | 
				
			||||||
        return getBooleanValue(ABILITIES, ACTIVATION, LEVEL_GATE_ABILITIES);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int getCooldown(SuperAbilityType ability) {
 | 
					    public int getCooldown(SuperAbilityType ability) {
 | 
				
			||||||
        return getIntValue(ABILITIES, COOLDOWNS + ability.toString());
 | 
					        return getIntValue(ABILITIES, COOLDOWNS + ability.toString());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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.")
 | 
					    @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;
 | 
					    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;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,4 +15,19 @@ public class ConfigCategoryMaxConnections {
 | 
				
			|||||||
    @Setting(value = "Save")
 | 
					    @Setting(value = "Save")
 | 
				
			||||||
    private int save = 30;
 | 
					    private int save = 30;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * GETTER BOILERPLATE
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getMisc() {
 | 
				
			||||||
 | 
					        return misc;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getLoad() {
 | 
				
			||||||
 | 
					        return load;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getSave() {
 | 
				
			||||||
 | 
					        return save;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,4 +13,20 @@ public class ConfigCategoryMaxPoolSize {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Setting(value = "Save")
 | 
					    @Setting(value = "Save")
 | 
				
			||||||
    private int save = 20;
 | 
					    private int save = 20;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * GETTER BOILERPLATE
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getMisc() {
 | 
				
			||||||
 | 
					        return misc;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getLoad() {
 | 
				
			||||||
 | 
					        return load;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getSave() {
 | 
				
			||||||
 | 
					        return save;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,5 +12,15 @@ public class ConfigCategoryMySQL {
 | 
				
			|||||||
    @Setting(value = "Database", comment = "Database settings for MySQL/MariaDB")
 | 
					    @Setting(value = "Database", comment = "Database settings for MySQL/MariaDB")
 | 
				
			||||||
    private ConfigCategoryDatabase configCategoryDatabase;
 | 
					    private ConfigCategoryDatabase configCategoryDatabase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * GETTER BOILERPLATE
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean isMySQLEnabled() {
 | 
				
			||||||
 | 
					        return enabled;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ConfigCategoryDatabase getConfigCategoryDatabase() {
 | 
				
			||||||
 | 
					        return configCategoryDatabase;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,4 +16,20 @@ public class ConfigCategoryServer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Setting(value = "Server_Address", comment = "The address for your MySQL/MariaDB server")
 | 
					    @Setting(value = "Server_Address", comment = "The address for your MySQL/MariaDB server")
 | 
				
			||||||
    private String serverAddress = "localhost";
 | 
					    private String serverAddress = "localhost";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * GETTER BOILERPLATE
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean isUseSSL() {
 | 
				
			||||||
 | 
					        return useSSL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getServerPort() {
 | 
				
			||||||
 | 
					        return serverPort;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getServerAddress() {
 | 
				
			||||||
 | 
					        return serverAddress;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,4 +32,12 @@ public class ConfigDatabase extends Config {
 | 
				
			|||||||
    public double getConfigVersion() {
 | 
					    public double getConfigVersion() {
 | 
				
			||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * GETTER BOILERPLATE
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ConfigCategoryMySQL getConfigCategoryMySQL() {
 | 
				
			||||||
 | 
					        return configCategoryMySQL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package com.gmail.nossr50.config.hocon.superabilities;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@ConfigSerializable
 | 
				
			||||||
 | 
					public class ConfigSuperAbilities {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -332,10 +332,8 @@ Skills:
 | 
				
			|||||||
        Enabled_For_PVP: true
 | 
					        Enabled_For_PVP: true
 | 
				
			||||||
        Enabled_For_PVE: true
 | 
					        Enabled_For_PVE: true
 | 
				
			||||||
        Level_Cap: 0
 | 
					        Level_Cap: 0
 | 
				
			||||||
        Ability_Activation_Level_Gate: 10
 | 
					 | 
				
			||||||
    Excavation:
 | 
					    Excavation:
 | 
				
			||||||
        Level_Cap: 0
 | 
					        Level_Cap: 0
 | 
				
			||||||
        Ability_Activation_Level_Gate: 10
 | 
					 | 
				
			||||||
    Fishing:
 | 
					    Fishing:
 | 
				
			||||||
        Level_Cap: 0
 | 
					        Level_Cap: 0
 | 
				
			||||||
        Drops_Enabled: true
 | 
					        Drops_Enabled: true
 | 
				
			||||||
@@ -349,7 +347,6 @@ Skills:
 | 
				
			|||||||
    Mining:
 | 
					    Mining:
 | 
				
			||||||
        Level_Cap: 0
 | 
					        Level_Cap: 0
 | 
				
			||||||
        Detonator_Name: FLINT_AND_STEEL
 | 
					        Detonator_Name: FLINT_AND_STEEL
 | 
				
			||||||
        Ability_Activation_Level_Gate: 10
 | 
					 | 
				
			||||||
    Repair:
 | 
					    Repair:
 | 
				
			||||||
        Level_Cap: 0
 | 
					        Level_Cap: 0
 | 
				
			||||||
        Anvil_Messages: true
 | 
					        Anvil_Messages: true
 | 
				
			||||||
@@ -372,7 +369,6 @@ Skills:
 | 
				
			|||||||
        Enabled_For_PVP: true
 | 
					        Enabled_For_PVP: true
 | 
				
			||||||
        Enabled_For_PVE: true
 | 
					        Enabled_For_PVE: true
 | 
				
			||||||
        Level_Cap: 0
 | 
					        Level_Cap: 0
 | 
				
			||||||
        Ability_Activation_Level_Gate: 10
 | 
					 | 
				
			||||||
    Taming:
 | 
					    Taming:
 | 
				
			||||||
        Enabled_For_PVP: true
 | 
					        Enabled_For_PVP: true
 | 
				
			||||||
        Enabled_For_PVE: true
 | 
					        Enabled_For_PVE: true
 | 
				
			||||||
@@ -409,7 +405,6 @@ Skills:
 | 
				
			|||||||
        Enabled_For_PVP: true
 | 
					        Enabled_For_PVP: true
 | 
				
			||||||
        Enabled_For_PVE: true
 | 
					        Enabled_For_PVE: true
 | 
				
			||||||
        Level_Cap: 0
 | 
					        Level_Cap: 0
 | 
				
			||||||
        Ability_Activation_Level_Gate: 10
 | 
					 | 
				
			||||||
        Block_Cracker:
 | 
					        Block_Cracker:
 | 
				
			||||||
            SmoothBrick_To_CrackedBrick: true
 | 
					            SmoothBrick_To_CrackedBrick: true
 | 
				
			||||||
        # When using Unarmed, picked up items will automatically get moved to a free slot instead of going in the slot
 | 
					        # 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:
 | 
					    Woodcutting:
 | 
				
			||||||
        Tree_Feller_Sounds: true
 | 
					        Tree_Feller_Sounds: true
 | 
				
			||||||
        Level_Cap: 0
 | 
					        Level_Cap: 0
 | 
				
			||||||
        Ability_Activation_Level_Gate: 10
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  Settings for Double Drops
 | 
					#  Settings for Double Drops
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user