Browse Source

Update /party to use Bukkit CommandAPI for permissions & description -
usage is handled internally due to the number of subcommands.

GJ 12 years ago
parent
commit
3da062c4cc

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

@@ -26,6 +26,7 @@ import com.gmail.nossr50.database.commands.McpurgeCommand;
 import com.gmail.nossr50.database.commands.McremoveCommand;
 import com.gmail.nossr50.database.commands.MmoupdateCommand;
 import com.gmail.nossr50.locale.LocaleLoader;
+import com.gmail.nossr50.party.commands.PartyCommand;
 import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand;
 import com.gmail.nossr50.skills.archery.ArcheryCommand;
 import com.gmail.nossr50.skills.axes.AxesCommand;
@@ -312,4 +313,15 @@ public final class CommandRegistrationHelper {
         command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xplock", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
         command.setExecutor(new XplockCommand());
     }
+
+    public static void registerPartyCommand() {
+        PluginCommand command = mcMMO.p.getCommand("party");
+        command.setDescription(LocaleLoader.getString("Commands.Description.party"));
+        command.setPermission("mcmmo.commands.party;mcmmo.commands.party.accept;mcmmo.commands.party.create;mcmmo.commands.party.disband;" +
+                              "mcmmo.commands.party.expshare;mcmmo.commands.party.invite;mcmmo.commands.party.itemshare;mcmmo.commands.party.join;" +
+                              "mcmmo.commands.party.kick;mcmmo.commands.party.lock;mcmmo.commands.party.owner;mcmmo.commands.party.password;" +
+                              "mcmmo.commands.party.quit;mcmmo.commands.party.rename;mcmmo.commands.party.unlock");
+        command.setPermissionMessage(permissionsMessage);
+        command.setExecutor(new PartyCommand());
+    }
 }

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

@@ -44,7 +44,6 @@ import com.gmail.nossr50.mods.config.CustomBlocksConfig;
 import com.gmail.nossr50.mods.config.CustomEntityConfig;
 import com.gmail.nossr50.mods.config.CustomToolsConfig;
 import com.gmail.nossr50.party.PartyManager;
-import com.gmail.nossr50.party.commands.PartyCommand;
 import com.gmail.nossr50.party.commands.PtpCommand;
 import com.gmail.nossr50.runnables.MobStoreCleaner;
 import com.gmail.nossr50.runnables.SaveTimer;
@@ -287,7 +286,7 @@ public class mcMMO extends JavaPlugin {
 
         // Party commands
         CommandRegistrationHelper.registerAdminChatCommand();
-        getCommand("party").setExecutor(new PartyCommand());
+        CommandRegistrationHelper.registerPartyCommand();
         CommandRegistrationHelper.registerPartyChatCommand();
         getCommand("ptp").setExecutor(new PtpCommand(this));
 

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

@@ -704,6 +704,7 @@ Commands.Description.mcstats=Show your mcMMO levels and XP
 Commands.Description.mctop=Show mcMMO leader boards
 Commands.Description.mmoedit=Edit mcMMO levels for a user
 Commands.Description.mmoupdate=Convert mcMMO database from Flatfile to MySQL
+Commands.Description.party=Control various mcMMO party settings
 Commands.Description.partychat=Toggle mcMMO party chat on/off or send party chat messages
 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

@@ -58,7 +58,6 @@ commands:
         aliases: []
         description: Teleport to a party member
     party:
-        aliases: []
         description: Create/join a party
     inspect:
         description: View detailed mcMMO info on another player