From 3da062c4ccf20a12e675d7f856f448424cd8516f Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 7 Feb 2013 23:05:59 -0500 Subject: [PATCH] Update /party to use Bukkit CommandAPI for permissions & description - usage is handled internally due to the number of subcommands. --- .../nossr50/commands/CommandRegistrationHelper.java | 12 ++++++++++++ src/main/java/com/gmail/nossr50/mcMMO.java | 3 +-- src/main/resources/locale/locale_en_US.properties | 1 + src/main/resources/plugin.yml | 1 - 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/CommandRegistrationHelper.java b/src/main/java/com/gmail/nossr50/commands/CommandRegistrationHelper.java index f944ae605..ef4ed8022 100644 --- a/src/main/java/com/gmail/nossr50/commands/CommandRegistrationHelper.java +++ b/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()); + } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 9aa33a9a5..2747cb1f1 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/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)); diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index f5452830e..c1a6a4372 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/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 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 841e4b695..54ba83f91 100644 --- a/src/main/resources/plugin.yml +++ b/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