From 6d61e7e419c9cc04805762f27d0b885c2fb98a1e Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Tue, 12 Jul 2011 18:44:57 -0600 Subject: [PATCH] Fix command descriptions, upgrade CH --- lib/commandhandler | 2 +- .../command/commands/HelpCommand.java | 26 ++++++++++++++----- .../command/commands/RemoveCommand.java | 2 +- .../command/commands/TeleportCommand.java | 2 +- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/lib/commandhandler b/lib/commandhandler index 451b7c4f..ef9ef519 160000 --- a/lib/commandhandler +++ b/lib/commandhandler @@ -1 +1 @@ -Subproject commit 451b7c4ff729f0c2008cf90c9cf825b6a649a851 +Subproject commit ef9ef51925bdb9f2ad6d42558185e03a81581ebb diff --git a/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java index bcf1b8a9..cd1548a5 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java @@ -31,6 +31,9 @@ public class HelpCommand extends Command { @Override public void runCommand(CommandSender sender, List 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 availableCommands = new ArrayList (((MultiverseCore) this.plugin).getCommandHandler().getAllCommands()); - for(Command c : availableCommands) { - if(!((MultiverseCore) this.plugin).getPermissions().hasPermission(sender, c.getPermission(), c.isOpRequired())) { + List availableCommands = new ArrayList(((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(" "); } } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/RemoveCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/RemoveCommand.java index f00398db..e03b2bda 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/RemoveCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/RemoveCommand.java @@ -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"); diff --git a/src/com/onarandombox/MultiverseCore/command/commands/TeleportCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/TeleportCommand.java index 7ff48c63..1adbe918 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/TeleportCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/TeleportCommand.java @@ -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");