Răsfoiți Sursa

Having an option to disable commands from the config was a bad idea that
encouraged lazy admins.

NOTE: If you were using these config options instead of relying on
permissions, you will need to reconfigure these commands to be disabled
via permissions.

GJ 12 ani în urmă
părinte
comite
2df285fd7c

+ 1 - 1
src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java

@@ -44,7 +44,7 @@ public class MccCommand implements CommandExecutor {
         player.sendMessage("/mcstats " + LocaleLoader.getString("Commands.Stats"));
         player.sendMessage("/mctop " + LocaleLoader.getString("Commands.Leaderboards"));
 
-        if (Config.getInstance().getCommandSkillResetEnabled() && Permissions.skillReset(player)) {
+        if (Permissions.skillReset(player)) {
             player.sendMessage("/skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
         }
 

+ 2 - 25
src/main/java/com/gmail/nossr50/config/Config.java

@@ -30,6 +30,7 @@ public class Config extends ConfigLoader {
     /* General Settings */
     public String getLocale() { return config.getString("General.Locale", "en_us"); }
     public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
+    public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
     public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); }
     public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
     public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
@@ -74,34 +75,10 @@ public class Config extends ConfigLoader {
     public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
     public boolean getBlockModsEnabled() { return config.getBoolean("Mods.Block_Mods_Enabled", false); }
 
-    /* Commands */
-    public boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); }
-    public boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); }
-    public boolean getCommandMCTopEnabled() { return config.getBoolean("Commands.mctop.Enabled", true); }
-    public boolean getCommandMCRankEnabled() { return config.getBoolean("Commands.mcrank.Enabled", true); }
-    public boolean getCommandAddXPEnabled() { return config.getBoolean("Commands.addxp.Enabled", true); }
-    public boolean getCommandMCAbilityEnabled() { return config.getBoolean("Commands.mcability.Enabled", true); }
-    public boolean getCommandMCRefreshEnabled() { return config.getBoolean("Commands.mcrefresh.Enabled", true); }
-    public boolean getCommandmcMMOEnabled() { return config.getBoolean("Commands.mcmmo.Enabled", true); }
-    public boolean getCommandMCCEnabled() { return config.getBoolean("Commands.mcc.Enabled", true); }
-    public boolean getCommandMCGodEnabled() { return config.getBoolean("Commands.mcgod.Enabled", true); }
-    public boolean getCommandMCStatsEnabled() { return config.getBoolean("Commands.mcstats.Enabled", true); }
-    public boolean getCommandSkillResetEnabled() { return config.getBoolean("Commands.skillreset.Enabled", true); }
-    public boolean getCommandMmoeditEnabled() { return config.getBoolean("Commands.mmoedit.Enabled", true); }
-    public boolean getCommandMCRemoveEnabled() { return config.getBoolean("Commands.mcremove.Enable", true); }
-    public boolean getCommandMCPurgeEnabled() { return config.getBoolean("Commands.mcpurge.Enable", true); }
-    public boolean getCommandPTPEnabled() { return config.getBoolean("Commands.ptp.Enabled", true); }
-    public boolean getCommandPartyEnabled() { return config.getBoolean("Commands.party.Enabled", true); }
-    public boolean getCommandInspectEnabled() { return config.getBoolean("Commands.inspect.Enabled", true); }
-    public boolean getCommandInviteEnabled() { return config.getBoolean("Commands.invite.Enabled", true); }
-    public boolean getCommandAcceptEnabled() { return config.getBoolean("Commands.accept.Enabled", true); }
-    public boolean getCommandAdminChatAEnabled() { return config.getBoolean("Commands.a.Enabled", true); }
-    public boolean getCommandPartyChatPEnabled() { return config.getBoolean("Commands.p.Enabled", true); }
-
+    /* Party Teleport Settings */
     public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); }
     public int getPTPCommandTimeout() { return config.getInt("Commands.ptp.Request_Timeout", 300); }
     public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Confirm_Required", true); }
-    public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
 
     /* Items */
     public int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); }

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

@@ -327,92 +327,34 @@ public class mcMMO extends JavaPlugin {
         Config configInstance = Config.getInstance();
 
         // mc* commands
-        if (configInstance.getCommandMCPurgeEnabled()) {
-            getCommand("mcpurge").setExecutor(new McpurgeCommand());
-        }
-        if (configInstance.getCommandMCRemoveEnabled()) {
-            getCommand("mcremove").setExecutor(new McremoveCommand());
-        }
-
-        if (configInstance.getCommandMCAbilityEnabled()) {
-            getCommand("mcability").setExecutor(new McabilityCommand());
-        }
-
-        if (configInstance.getCommandMCCEnabled()) {
-            getCommand("mcc").setExecutor(new MccCommand());
-        }
-
-        if (configInstance.getCommandMCGodEnabled()) {
-            getCommand("mcgod").setExecutor(new McgodCommand());
-        }
-
-        if (configInstance.getCommandmcMMOEnabled()) {
-            getCommand("mcmmo").setExecutor(new McmmoCommand());
-        }
-
-        if (configInstance.getCommandMCRefreshEnabled()) {
-            getCommand("mcrefresh").setExecutor(new McrefreshCommand());
-        }
-
-        if (configInstance.getCommandMCTopEnabled()) {
-            getCommand("mctop").setExecutor(new MctopCommand());
-        }
-
-        if(configInstance.getCommandMCRankEnabled()) {
-            getCommand("mcrank").setExecutor(new McrankCommand());
-        }
-
-        if (configInstance.getCommandMCStatsEnabled()) {
-            getCommand("mcstats").setExecutor(new McstatsCommand());
-        }
-
-        if (configInstance.getCommandSkillResetEnabled()) {
-            getCommand("skillreset").setExecutor(new SkillResetCommand());
-        }
+        getCommand("mcpurge").setExecutor(new McpurgeCommand());
+        getCommand("mcremove").setExecutor(new McremoveCommand());
+        getCommand("mcability").setExecutor(new McabilityCommand());
+        getCommand("mcc").setExecutor(new MccCommand());
+        getCommand("mcgod").setExecutor(new McgodCommand());
+        getCommand("mcmmo").setExecutor(new McmmoCommand());
+        getCommand("mcrefresh").setExecutor(new McrefreshCommand());
+        getCommand("mctop").setExecutor(new MctopCommand());
+        getCommand("mcrank").setExecutor(new McrankCommand());
+        getCommand("mcstats").setExecutor(new McstatsCommand());
 
         // Party commands
-        if (configInstance.getCommandAdminChatAEnabled()) {
-            getCommand("a").setExecutor(new ACommand());
-        }
-
-        if (configInstance.getCommandPartyEnabled()) {
-            getCommand("party").setExecutor(new PartyCommand());
-        }
-
-        if (configInstance.getCommandPartyChatPEnabled()) {
-            getCommand("p").setExecutor(new PCommand(this));
-        }
-
-        if (configInstance.getCommandPTPEnabled()) {
-            getCommand("ptp").setExecutor(new PtpCommand(this));
-        }
+        getCommand("a").setExecutor(new ACommand());
+        getCommand("party").setExecutor(new PartyCommand());
+        getCommand("p").setExecutor(new PCommand(this));
+        getCommand("ptp").setExecutor(new PtpCommand(this));
 
         // Other commands
-        if (configInstance.getCommandAddXPEnabled()) {
-            getCommand("addxp").setExecutor(new AddxpCommand());
-        }
-
+        getCommand("addxp").setExecutor(new AddxpCommand());
         CommandRegistrationHelper.registerAddlevelsCommand();
-
-        if (configInstance.getCommandMmoeditEnabled()) {
-            getCommand("mmoedit").setExecutor(new MmoeditCommand());
-        }
-
-        if (configInstance.getCommandInspectEnabled()) {
-            getCommand("inspect").setExecutor(new InspectCommand());
-        }
-
-        if (configInstance.getCommandXPRateEnabled()) {
-            getCommand("xprate").setExecutor(new XprateCommand());
-        }
-
+        getCommand("mmoedit").setExecutor(new MmoeditCommand());
+        getCommand("inspect").setExecutor(new InspectCommand());
+        getCommand("xprate").setExecutor(new XprateCommand());
         getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
+        getCommand("skillreset").setExecutor(new SkillResetCommand());
 
         // Spout commands
-        if (configInstance.getCommandXPLockEnabled()) {
-            getCommand("xplock").setExecutor(new XplockCommand());
-        }
-
+        getCommand("xplock").setExecutor(new XplockCommand());
         getCommand("mchud").setExecutor(new MchudCommand());
     }
 

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

@@ -27,7 +27,7 @@ public class XplockCommand implements CommandExecutor {
             return true;
         }
 
-        if (!mcMMO.spoutEnabled || !Config.getInstance().getCommandXPLockEnabled() || !SpoutConfig.getInstance().getXPBarEnabled()) {
+        if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
             sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
             return true;
         }