Browse Source

Config overhaul part 3

nossr50 13 years ago
parent
commit
945e5ca11c

+ 1 - 1
src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java

@@ -26,7 +26,7 @@ public class XplockCommand implements CommandExecutor {
             return true;
         }
 
-        if (!Config.spoutEnabled || !Config.xpbar || !Config.xplockEnable) {
+        if (!Config.spoutEnabled || !Config.xpbar || !Config.getCommandXPLockEnabled()) {
             sender.sendMessage(mcLocale.getString("Commands.Disabled"));
             return true;
         }

+ 21 - 26
src/main/java/com/gmail/nossr50/config/Config.java

@@ -31,11 +31,27 @@ public class Config extends ConfigLoader{
     }
 
     /* Commands */
-    public static Boolean xplockEnable, xprateEnable, mccEnable, mcmmoEnable,
-                          partyEnable, inviteEnable, acceptEnable, inspectEnable,
-                          mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable,
-                          mcremoveEnable, mcgodEnable, mcabilityEnable, mctopEnable,
-                          addlevelsEnable, mcrefreshEnable, aEnable, pEnable;
+    public static boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); }
+    public static boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); }
+    public static boolean getCommandMCTopEnabled() { return config.getBoolean("Commands.mctop.Enabled", true); }
+    public static boolean getCommandAddXPEnabled() { return config.getBoolean("Commands.addxp.Enabled", true); }
+    public static boolean getCommandAddLevelsEnabled() { return config.getBoolean("Commands.addlevels.Enabled", true); }
+    public static boolean getCommandMCAbilityEnabled() { return config.getBoolean("Commands.mcability.Enabled", true); }
+    public static boolean getCommandMCRefreshEnabled() { return config.getBoolean("Commands.mcrefresh.Enabled", true); }
+    public static boolean getCommandmcMMOEnabled() { return config.getBoolean("Commands.mcmmo.Enabled", true); }
+    public static boolean getCommandMCCEnabled() { return config.getBoolean("Commands.mcc.Enabled", true); }
+    public static boolean getCommandMCGodEnabled() { return config.getBoolean("Commands.mcgod.Enabled", true); }
+    public static boolean getCommandMCStatsEnabled() { return config.getBoolean("Commands.mcstats.Enabled", true); }
+    public static boolean getCommandMmoeditEnabled() { return config.getBoolean("Commands.mmoedit.Enabled", true); }
+    public static boolean getCommandMCRemoveEnabled() { return config.getBoolean("Commands.mcremove.Enable", true); }
+    public static boolean getCommandPTPEnabled() { return config.getBoolean("Commands.ptp.Enabled", true); }
+    public static boolean getCommandPartyEnabled() { return config.getBoolean("Commands.party.Enabled", true); }
+    public static boolean getCommandInspectEnabled() { return config.getBoolean("Commands.inspect.Enabled", true); }
+    public static boolean getCommandInviteEnabled() { return config.getBoolean("Commands.invite.Enabled", true); }
+    public static boolean getCommandAcceptEnabled() { return config.getBoolean("Commands.accept.Enabled", true); }
+    public static boolean getCommandAdminChatAEnabled() { return config.getBoolean("Commands.a.Enabled", true); }
+    public static boolean getCommandPartyChatPEnabled() { return config.getBoolean("Commands.p.Enabled", true); }
+
     public static int ptpCommandCooldown;
     public static Boolean donateMessage;
 
@@ -421,27 +437,6 @@ public class Config extends ConfigLoader{
         fishingTier4 = config.getInt("Fishing.Tier_Levels.Tier4", 600);
         fishingTier5 = config.getInt("Fishing.Tier_Levels.Tier5", 800);
 
-        xplockEnable = config.getBoolean("Commands.xplock.Enabled", true);
-        xprateEnable = config.getBoolean("Commands.xprate.Enabled", true);
-        mctopEnable = config.getBoolean("Commands.mctop.Enabled", true);
-        addxpEnable = config.getBoolean("Commands.addxp.Enabled", true);
-        addlevelsEnable = config.getBoolean("Commands.addlevels.Enabled", true);
-        mcabilityEnable = config.getBoolean("Commands.mcability.Enabled", true);
-        mcrefreshEnable = config.getBoolean("Commands.mcrefresh.Enabled", true);
-        mcmmoEnable = config.getBoolean("Commands.mcmmo.Enabled", true);
-        mccEnable = config.getBoolean("Commands.mcc.Enabled", true);
-        mcgodEnable = config.getBoolean("Commands.mcgod.Enabled", true);
-        mcstatsEnable = config.getBoolean("Commands.mcstats.Enabled", true);
-        mmoeditEnable = config.getBoolean("Commands.mmoedit.Enabled", true);
-        mcremoveEnable = config.getBoolean("Commands.mcremove.Enable", true);
-        ptpEnable = config.getBoolean("Commands.ptp.Enabled", true);
-        partyEnable = config.getBoolean("Commands.party.Enabled", true);
-        inspectEnable = config.getBoolean("Commands.inspect.Enabled", true);
-        inviteEnable = config.getBoolean("Commands.invite.Enabled", true);
-        acceptEnable = config.getBoolean("Commands.accept.Enabled", true);
-        aEnable = config.getBoolean("Commands.a.Enabled", true);
-        pEnable = config.getBoolean("Commands.p.Enabled", true);
-
         ptpCommandCooldown = config.getInt("Commands.ptp.Cooldown", 30);
 
         detonatorID = config.getInt("Skills.Mining.Detonator_ID", 259);

+ 20 - 20
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -247,88 +247,88 @@ public class mcMMO extends JavaPlugin {
         getCommand("woodcutting").setExecutor(new WoodcuttingCommand());
 
         //mc* commands
-        if (Config.mcremoveEnable) {
+        if (Config.getCommandMCRemoveEnabled()) {
             getCommand("mcremove").setExecutor(new McremoveCommand(this));
         }
 
-        if (Config.mcabilityEnable) {
+        if (Config.getCommandMCAbilityEnabled()) {
             getCommand("mcability").setExecutor(new McabilityCommand());
         }
 
-        if (Config.mccEnable) {
+        if (Config.getCommandMCCEnabled()) {
             getCommand("mcc").setExecutor(new MccCommand());
         }
 
-        if (Config.mcgodEnable) {
+        if (Config.getCommandMCGodEnabled()) {
             getCommand("mcgod").setExecutor(new McgodCommand());
         }
 
-        if (Config.mcmmoEnable) {
+        if (Config.getCommandmcMMOEnabled()) {
             getCommand("mcmmo").setExecutor(new McmmoCommand());
         }
 
-        if (Config.mcrefreshEnable) {
+        if (Config.getCommandMCRefreshEnabled()) {
             getCommand("mcrefresh").setExecutor(new McrefreshCommand(this));
         }
 
-        if (Config.mctopEnable) {
+        if (Config.getCommandMCTopEnabled()) {
             getCommand("mctop").setExecutor(new MctopCommand());
         }
 
-        if (Config.mcstatsEnable) {
+        if (Config.getCommandMCStatsEnabled()) {
             getCommand("mcstats").setExecutor(new McstatsCommand());
         }
 
         //Party commands
-        if (Config.acceptEnable) {
+        if (Config.getCommandAcceptEnabled()) {
             getCommand("accept").setExecutor(new AcceptCommand(this));
         }
 
-        if (Config.aEnable) {
+        if (Config.getCommandAdminChatAEnabled()) {
             getCommand("a").setExecutor(new ACommand(this));
         }
 
-        if (Config.inviteEnable) {
+        if (Config.getCommandInviteEnabled()) {
             getCommand("invite").setExecutor(new InviteCommand(this));
         }
 
-        if (Config.partyEnable) {
+        if (Config.getCommandPartyEnabled()) {
             getCommand("party").setExecutor(new PartyCommand(this));
         }
 
-        if (Config.pEnable) {
+        if (Config.getCommandPartyChatPEnabled()) {
             getCommand("p").setExecutor(new PCommand(this));
         }
 
-        if (Config.ptpEnable) {
+        if (Config.getCommandPTPEnabled()) {
             getCommand("ptp").setExecutor(new PtpCommand(this));
         }
 
         //Other commands
-        if (Config.addxpEnable) {
+        if (Config.getCommandAddXPEnabled()) {
             getCommand("addxp").setExecutor(new AddxpCommand(this));
         }
 
-        if (Config.addlevelsEnable) {
+        if (Config.getCommandAddLevelsEnabled()) {
             getCommand("addlevels").setExecutor(new AddlevelsCommand(this));
         }
 
-        if (Config.mmoeditEnable) {
+        if (Config.getCommandMmoeditEnabled()) {
             getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
         }
 
-        if (Config.inspectEnable) {
+        if (Config.getCommandInspectEnabled()) {
             getCommand("inspect").setExecutor(new InspectCommand(this));
         }
 
-        if (Config.xprateEnable) {
+        if (Config.getCommandXPRateEnabled()) {
             getCommand("xprate").setExecutor(new XprateCommand(this));
         }
 
         getCommand("mmoupdate").setExecutor(new MmoupdateCommand(this));
 
         //Spout commands
-        if (Config.xplockEnable) {
+        if (Config.getCommandXPLockEnabled()) {
             getCommand("xplock").setExecutor(new XplockCommand());
         }