From af6455ea6bfd5c29ff68a3f8b7fc289ba6f6f335 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Thu, 15 Dec 2011 06:28:09 +0100 Subject: [PATCH] Made //help sort // commands ignoring prefixed slashes. --- .../sk89q/worldedit/commands/UtilityCommands.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/commands/UtilityCommands.java b/src/main/java/com/sk89q/worldedit/commands/UtilityCommands.java index c8ef6f448..43a623e7d 100644 --- a/src/main/java/com/sk89q/worldedit/commands/UtilityCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/UtilityCommands.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.commands; +import java.util.Comparator; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -445,10 +446,19 @@ public class UtilityCommands { final CommandsManager commandsManager = we.getCommandsManager(); if (args.argsLength() == 0) { + SortedSet commands = new TreeSet(new Comparator() { + public int compare(String o1, String o2) { + final int ret = o1.replaceAll("/", "").compareToIgnoreCase(o2.replaceAll("/", "")); + if (ret == 0) { + return o1.compareToIgnoreCase(o2); + } + return ret; + } + }); + commands.addAll(commandsManager.getCommands().keySet()); + StringBuilder sb = new StringBuilder(); boolean first = true; - SortedSet commands = new TreeSet(commandsManager.getCommands().keySet()); - for (String command : commands) { if (!first) { sb.append(", ");