diff --git a/src/com/onarandombox/MultiverseCore/command/CommandManager.java b/src/com/onarandombox/MultiverseCore/command/CommandManager.java index 52b4161b..32d7e01a 100644 --- a/src/com/onarandombox/MultiverseCore/command/CommandManager.java +++ b/src/com/onarandombox/MultiverseCore/command/CommandManager.java @@ -69,10 +69,21 @@ public class CommandManager { this.commands.remove(command); } + @Deprecated public List getCommands() { return this.commands; } + public List getCommands(CommandSender sender) { + ArrayList playerCommands = new ArrayList(); + for(BaseCommand c : this.commands) { + if(this.hasPermission(sender, c.permission, c.isOpRequired())) { + playerCommands.add(c); + } + } + return playerCommands; + } + /** * Combines all quoted strings * @@ -134,7 +145,6 @@ public class CommandManager { return true; } Player player = (Player) sender; - System.out.print("Checking permissions for " + player.getName()); if (player.isOp()) { // If Player is Op we always let them use it. diff --git a/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java index c71c63b1..289f5ee2 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java @@ -42,7 +42,8 @@ public class HelpCommand extends BaseCommand { } } - List commands = plugin.getCommandManager().getCommands(); + // Get only the commands this player has access to + List commands = plugin.getCommandManager().getCommands(sender); int numPages = commands.size() / CMDS_PER_PAGE; if (commands.size() % CMDS_PER_PAGE != 0) {