From 5d693c5d8f934ec58b63194e142d2f9c212d1cf9 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 12 Feb 2013 11:42:13 -0500 Subject: [PATCH] Convert /party help to a subcommand --- .../nossr50/party/commands/PartyCommand.java | 14 ++------- .../party/commands/PartyHelpCommand.java | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/party/commands/PartyHelpCommand.java diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java index 6a83d1434..1703c272f 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java @@ -29,6 +29,7 @@ public class PartyCommand implements CommandExecutor { private CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand(); private CommandExecutor partyRenameCommand = new PartyRenameCommand(); private CommandExecutor partyInfoCommand = new PartyInfoCommand(); + private CommandExecutor partyHelpCommand = new PartyHelpCommand(); @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { @@ -67,7 +68,7 @@ public class PartyCommand implements CommandExecutor { case CREATE: return partyCreateCommand.onCommand(sender, command, label, args); case HELP: - return printHelp(); + return partyHelpCommand.onCommand(sender, command, label, args); default: break; } @@ -126,15 +127,4 @@ public class PartyCommand implements CommandExecutor { player.sendMessage(LocaleLoader.getString("Party.Help.2", "/party ?")); return true; } - - private boolean printHelp() { - player.sendMessage(LocaleLoader.getString("Party.Help.3", "/party join", "/party quit")); - player.sendMessage(LocaleLoader.getString("Party.Help.1", "/party create")); - player.sendMessage(LocaleLoader.getString("Party.Help.4", "/party ")); - player.sendMessage(LocaleLoader.getString("Party.Help.5", "/party password")); - player.sendMessage(LocaleLoader.getString("Party.Help.6", "/party kick")); - player.sendMessage(LocaleLoader.getString("Party.Help.7", "/party owner")); - player.sendMessage(LocaleLoader.getString("Party.Help.8", "/party disband")); - return true; - } } diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartyHelpCommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartyHelpCommand.java new file mode 100644 index 000000000..9e63d4666 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyHelpCommand.java @@ -0,0 +1,30 @@ +package com.gmail.nossr50.party.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +import com.gmail.nossr50.locale.LocaleLoader; + +public class PartyHelpCommand implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + switch (args.length) { + case 1: + sender.sendMessage(LocaleLoader.getString("Party.Help.3", "/party join", "/party quit")); + sender.sendMessage(LocaleLoader.getString("Party.Help.1", "/party create")); + sender.sendMessage(LocaleLoader.getString("Party.Help.4", "/party ")); + sender.sendMessage(LocaleLoader.getString("Party.Help.5", "/party password")); + sender.sendMessage(LocaleLoader.getString("Party.Help.6", "/party kick")); + sender.sendMessage(LocaleLoader.getString("Party.Help.7", "/party owner")); + sender.sendMessage(LocaleLoader.getString("Party.Help.8", "/party disband")); + return true; + + default: + sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "help")); + return true; + } + } + +}