@Command(
      name = "help",
      permission = Permissions.PERMISSION_HELP,
      descref = Messages.Help.Description.HELP,
      usage = "/spleef help")
  public void onHelpCommand(CommandContext context, HeavySpleef heavySpleef)
      throws CommandException {
    CommandSender sender = context.getSender();
    if (sender instanceof Player) {
      sender = heavySpleef.getSpleefPlayer(sender);
    }

    SpleefCommandManager manager = (SpleefCommandManager) heavySpleef.getCommandManager();
    CommandManagerService service = manager.getService();

    CommandContainer container = service.getCommand(BASE_COMMAND);
    List<CommandContainer> childs = Lists.newArrayList(container.getChildCommands());
    for (Iterator<CommandContainer> iterator = childs.iterator(); iterator.hasNext(); ) {
      CommandContainer child = iterator.next();
      String permission = child.getPermission();

      if (permission.isEmpty() || sender.hasPermission(child.getPermission())) {
        continue;
      }

      iterator.remove();
    }

    Collections.sort(childs, COMPARATOR);

    int maxPage = (int) Math.ceil(childs.size() / (double) RECORDS_PER_PAGE);
    int page = 0;
    if (context.argsLength() > 0) {
      try {
        page = Integer.parseInt(context.getString(0));
      } catch (NumberFormatException nfe) {
      }

      page = Math.max(page - 1, 0);
    }

    String header =
        i18n.getVarString(Messages.Command.HELP_HEADER)
            .setVariable("page", String.valueOf(page + 1))
            .setVariable("max-pages", String.valueOf(maxPage))
            .toString();

    if (sender instanceof SpleefPlayer) {
      ((SpleefPlayer) sender).sendUnprefixedMessage(header);
    } else {
      sender.sendMessage(header);
    }

    for (int i = page * RECORDS_PER_PAGE; i < page * RECORDS_PER_PAGE + RECORDS_PER_PAGE; i++) {
      if (i >= childs.size()) {
        break;
      }

      CommandContainer child = childs.get(i);

      String desc = child.getDescription();
      if (desc.isEmpty() && !child.getDescriptionRef().isEmpty()) {
        String i18nReference = child.getI18NRef();
        I18N i18n = I18NManager.getGlobal();

        if (!i18nReference.isEmpty()) {
          i18n = heavySpleef.getI18NManager().getI18N(i18nReference);
        }

        desc = i18n.getString(child.getDescriptionRef());
      }

      String record =
          i18n.getVarString(Messages.Command.HELP_RECORD)
              .setVariable("command_fq", child.getFullyQualifiedName())
              .setVariable("command", child.getName())
              .setVariable("usage", child.getUsage())
              .setVariable("description", desc)
              .toString();

      if (sender instanceof SpleefPlayer) {
        SpleefPlayer player = (SpleefPlayer) sender;
        player.sendUnprefixedMessage(record);
      } else {
        sender.sendMessage(record);
      }
    }
  }
 @Override
 public int compare(CommandContainer o1, CommandContainer o2) {
   return o1.getName().compareTo(o2.getName());
 }