private void sendSpecificHelp(CommandSender sender, String rootCommand, String modifier) throws CommandException { CommandInfo info = getCommand(rootCommand, modifier); if (info == null) throw new CommandException(CommandMessages.COMMAND_MISSING, rootCommand + " " + modifier); Messaging.send(sender, format(info.getCommandAnnotation(), rootCommand)); String help = Messaging.tryTranslate(info.getCommandAnnotation().help()); if (help.isEmpty()) return; Messaging.send(sender, ChatColor.AQUA + help); }
private List<String> getLines(CommandSender sender, String baseCommand) { // Ensures that commands with multiple modifiers are only added once Set<CommandInfo> processed = Sets.newHashSet(); List<String> lines = new ArrayList<String>(); for (CommandInfo info : getCommands(baseCommand)) { Command command = info.getCommandAnnotation(); if (processed.contains(info) || (!sender.hasPermission("citizens.admin") && !sender.hasPermission("citizens." + command.permission()))) continue; lines.add(format(command, baseCommand)); if (command.modifiers().length > 1) { processed.add(info); } } return lines; }