From bbc2091b77c761af8947ff3f2289932a57aad217 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 12 Feb 2013 12:04:37 -0500 Subject: [PATCH] Aliased /party chat to work for /partychat and /party teleport to work for /ptp --- .../nossr50/party/commands/PartyCommand.java | 17 +++++++++++++++++ .../nossr50/party/commands/PartySubcommand.java | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) 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 1703c272f..f5a64cc67 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java @@ -5,6 +5,7 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import com.gmail.nossr50.chat.commands.PartyChatCommand; import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.datatypes.McMMOPlayer; import com.gmail.nossr50.locale.LocaleLoader; @@ -30,6 +31,8 @@ public class PartyCommand implements CommandExecutor { private CommandExecutor partyRenameCommand = new PartyRenameCommand(); private CommandExecutor partyInfoCommand = new PartyInfoCommand(); private CommandExecutor partyHelpCommand = new PartyHelpCommand(); + private CommandExecutor partyTeleportCommand = new PtpCommand(); + private CommandExecutor partyChatCommand = new PartyChatCommand(); @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { @@ -86,6 +89,10 @@ public class PartyCommand implements CommandExecutor { return partyQuitCommand.onCommand(sender, command, label, args); case INVITE: return partyInviteCommand.onCommand(sender, command, label, args); + case TELEPORT: + return partyTeleportCommand.onCommand(sender, command, label, extractArgs(args)); + case CHAT: + return partyChatCommand.onCommand(sender, command, label, extractArgs(args)); default: break; } @@ -127,4 +134,14 @@ public class PartyCommand implements CommandExecutor { player.sendMessage(LocaleLoader.getString("Party.Help.2", "/party ?")); return true; } + + private String[] extractArgs(String[] args) { + String[] newArgs = new String[args.length - 1]; + + for (int i = 1; i < args.length; i++) { + newArgs[i - 1] = args[1]; + } + + return newArgs; + } } diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartySubcommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartySubcommand.java index 80ae1f495..87c39c587 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartySubcommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartySubcommand.java @@ -16,7 +16,9 @@ public enum PartySubcommand { LOCK, UNLOCK, PASSWORD, - RENAME; + RENAME, + TELEPORT, + CHAT; public static PartySubcommand getSubcommand(String commandName) { for (PartySubcommand command : values()) {