actually sort commands in help
This commit is contained in:
parent
5958da7b86
commit
2a92a02dd9
1 changed files with 11 additions and 3 deletions
|
@ -8,6 +8,7 @@ import net.kyori.adventure.text.JoinConfiguration;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class HelpCommand implements Command {
|
public class HelpCommand implements Command {
|
||||||
|
@ -74,10 +75,17 @@ public class HelpCommand implements Command {
|
||||||
public List<Component> getCommandListByTrustLevel(int trustLevel) {
|
public List<Component> getCommandListByTrustLevel(int trustLevel) {
|
||||||
final List<Component> list = new ArrayList<>();
|
final List<Component> list = new ArrayList<>();
|
||||||
|
|
||||||
for (Command command : bot.commandHandler().commands()) {
|
List<String> commandNames = new ArrayList<>();
|
||||||
final String name = command.name();
|
|
||||||
|
|
||||||
|
for (Command command : bot.commandHandler().commands()) {
|
||||||
if (command.trustLevel() != trustLevel) continue;
|
if (command.trustLevel() != trustLevel) continue;
|
||||||
|
|
||||||
|
commandNames.add(command.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(commandNames);
|
||||||
|
|
||||||
|
for (String name : commandNames) {
|
||||||
list.add(Component.text(name).color(getColorByTrustLevel(trustLevel)));
|
list.add(Component.text(name).color(getColorByTrustLevel(trustLevel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue