Преглед изворни кода

Update /mcstats to use Bukkit CommandAPI. Addresses #628

GJ пре 12 година
родитељ
комит
ef7aeb752e

+ 13 - 0
src/main/java/com/gmail/nossr50/commands/CommandRegistrationHelper.java

@@ -17,6 +17,7 @@ import com.gmail.nossr50.commands.player.InspectCommand;
 import com.gmail.nossr50.commands.player.McabilityCommand;
 import com.gmail.nossr50.commands.player.McmmoCommand;
 import com.gmail.nossr50.commands.player.McrankCommand;
+import com.gmail.nossr50.commands.player.McstatsCommand;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand;
 import com.gmail.nossr50.skills.archery.ArcheryCommand;
@@ -229,4 +230,16 @@ public final class CommandRegistrationHelper {
         command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrank", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
         command.setExecutor(new McrankCommand());
     }
+
+    public static void registerMcstatsCommand() {
+        List<String> aliasList = new ArrayList<String>();
+        aliasList.add("stats");
+
+        PluginCommand command = mcMMO.p.getCommand("mcstats");
+        command.setDescription(LocaleLoader.getString("Commands.Description.mcstats"));
+        command.setPermission("mcmmo.commands.mcstats");
+        command.setPermissionMessage(permissionsMessage);
+        command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcstats"));
+        command.setExecutor(new McstatsCommand());
+    }
 }

+ 1 - 2
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -26,7 +26,6 @@ import com.gmail.nossr50.chat.commands.ACommand;
 import com.gmail.nossr50.chat.commands.PCommand;
 import com.gmail.nossr50.commands.CommandRegistrationHelper;
 import com.gmail.nossr50.commands.player.MccCommand;
-import com.gmail.nossr50.commands.player.McstatsCommand;
 import com.gmail.nossr50.commands.player.MctopCommand;
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.config.Config;
@@ -446,7 +445,7 @@ public class mcMMO extends JavaPlugin {
         CommandRegistrationHelper.registerMcrefreshCommand();
         getCommand("mctop").setExecutor(new MctopCommand());
         CommandRegistrationHelper.registerMcrankCommand();
-        getCommand("mcstats").setExecutor(new McstatsCommand());
+        CommandRegistrationHelper.registerMcstatsCommand();
 
         // Party commands
         getCommand("a").setExecutor(new ACommand());

+ 1 - 0
src/main/resources/locale/locale_en_US.properties

@@ -697,6 +697,7 @@ Commands.Description.mcgod=Toggle mcMMO god-mode on/off
 Commands.Description.mcmmo=Show a brief description of mcMMO
 Commands.Description.mcrank=Show mcMMO ranking for a player
 Commands.Description.mcrefresh=Refresh all cooldowns for mcMMO
+Commands.Description.mcstats=Show your mcMMO levels and XP
 Commands.Description.mmoedit=Edit mcMMO levels for a user
 Commands.Description.Skill=Display detailed mcMMO skill info for {0}
 Commands.Description.skillreset=Reset mcMMO levels for a user

+ 0 - 1
src/main/resources/plugin.yml

@@ -49,7 +49,6 @@ commands:
     mcgod:
         description: Toggle mcMMO god-mode on/off
     mcstats:
-        aliases: [/stats]
         description: Shows your mcMMO stats and xp
     mcremove:
         aliases: []