3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 11:00:05 +01:00

Made //help sort // commands ignoring prefixed slashes.

Dieser Commit ist enthalten in:
TomyLobo 2011-12-15 06:28:09 +01:00
Ursprung caeab76abb
Commit af6455ea6b

Datei anzeigen

@ -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<LocalPlayer> commandsManager = we.getCommandsManager();
if (args.argsLength() == 0) {
SortedSet<String> commands = new TreeSet<String>(new Comparator<String>() {
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<String> commands = new TreeSet<String>(commandsManager.getCommands().keySet());
for (String command : commands) {
if (!first) {
sb.append(", ");