SteamWar/SpigotCore
Archiviert
13
0

Fix SWCommand help list sorting

Dieser Commit ist enthalten in:
yoyosource 2021-05-14 21:03:55 +02:00
Ursprung 9db16383e4
Commit 78985f15de
2 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -125,7 +125,15 @@ public abstract class SWCommand {
o2.varArgType != null ? Integer.MAX_VALUE : o2.arguments.length);
}
});
commandHelpList.sort(Comparator.comparingInt(o -> -o.subCommand.length));
commandHelpList.sort((o1, o2) -> {
int compare = Integer.compare(-o1.subCommand.length, -o2.subCommand.length);
if (compare != 0) {
return compare;
} else {
return Integer.compare(o1.method.getDeclaringClass() == SWCommand.class ? 0 : 1,
o2.method.getDeclaringClass() == SWCommand.class ? 0 : 1);
}
});
}
}

Datei anzeigen

@ -33,7 +33,7 @@ import static de.steamwar.command.SWCommandUtils.*;
class SubCommand {
private SWCommand swCommand;
private Method method;
Method method;
String description;
Parameter[] parameters;
String[] subCommand;