Convert /party help to a subcommand

This commit is contained in:
GJ 2013-02-12 11:42:13 -05:00
parent 8cd9942be6
commit 5d693c5d8f
2 changed files with 32 additions and 12 deletions

View File

@ -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 <lock|unlock>"));
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;
}
}

View File

@ -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 <lock|unlock>"));
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;
}
}
}