Fix command descriptions, upgrade CH

This commit is contained in:
Eric Stokes 2011-07-12 18:44:57 -06:00
parent 3ea2f42e7f
commit 6d61e7e419
4 changed files with 22 additions and 10 deletions

@ -1 +1 @@
Subproject commit 451b7c4ff729f0c2008cf90c9cf825b6a649a851
Subproject commit ef9ef51925bdb9f2ad6d42558185e03a81581ebb

View File

@ -31,6 +31,9 @@ public class HelpCommand extends Command {
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
int page = 1;
if (args.size() == 1) {
try {
@ -39,21 +42,30 @@ public class HelpCommand extends Command {
}
}
List<Command> availableCommands = new ArrayList<Command> (((MultiverseCore) this.plugin).getCommandHandler().getAllCommands());
for(Command c : availableCommands) {
if(!((MultiverseCore) this.plugin).getPermissions().hasPermission(sender, c.getPermission(), c.isOpRequired())) {
List<Command> availableCommands = new ArrayList<Command>(((MultiverseCore) this.plugin).getCommandHandler().getAllCommands());
for (Command c : availableCommands) {
if (!((MultiverseCore) this.plugin).getPermissions().hasPermission(sender, c.getPermission(), c.isOpRequired())) {
availableCommands.remove(c);
}
}
int totalPages = (int) Math.ceil(availableCommands.size() / ( CMDS_PER_PAGE + 0.0));
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
for (Command c : availableCommands) {
sender.sendMessage(ChatColor.AQUA + c.getCommandUsage());
}
return;
}
int totalPages = (int) Math.ceil(availableCommands.size() / (CMDS_PER_PAGE + 0.0));
if (page > totalPages) {
page = totalPages;
}
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
sender.sendMessage(ChatColor.AQUA + " Page " + page + " of " + totalPages);
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
this.showPage(page, sender, availableCommands);
}
@ -64,8 +76,8 @@ public class HelpCommand extends Command {
for (int i = start; i < end; i++) {
// For consistancy, print some extra lines if it's a player:
if (i < cmds.size()) {
sender.sendMessage(ChatColor.AQUA + cmds.get(i).getCommandUsage());
} else if(sender instanceof Player) {
sender.sendMessage(ChatColor.AQUA + cmds.get(i).getCommandUsage());
} else if (sender instanceof Player) {
sender.sendMessage(" ");
}
}

View File

@ -14,7 +14,7 @@ public class RemoveCommand extends Command {
super(plugin);
this.commandName = "Remove World";
this.commandDesc = "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.";
this.commandUsage = "/mvremove" + ChatColor.GREEN + " {WORLD} ";
this.commandUsage = "/mvremove " + ChatColor.GREEN + " {WORLD} ";
this.minimumArgLength = 1;
this.maximumArgLength = 1;
this.commandKeys.add("mvremove");

View File

@ -21,7 +21,7 @@ public class TeleportCommand extends Command {
super(plugin);
this.commandName = "Teleport";
this.commandDesc = "Teleports you to a different world.";
this.commandUsage = "/mvtp" + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}";
this.commandUsage = "/mvtp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}";
this.minimumArgLength = 1;
this.maximumArgLength = 2;
this.commandKeys.add("mvtp");