fix: show page numbers on tab complete

This commit is contained in:
Sekwah 2023-04-12 15:29:33 +01:00
parent 2cd64528a4
commit b2e19a1391

View File

@ -117,6 +117,10 @@ public class CommandWithSubCommands implements CommandTemplate {
if(args.length > 1) {
if(args[0].equalsIgnoreCase("help")) {
List<String> allowedCommands = new ArrayList<>(this.subCommandRegistry.getSubCommands());
int pages = (int) Math.ceil(allowedCommands.size() / (float) this.subCommandsPerPage);
for (int i = 1; i <= pages; i++) {
allowedCommands.add(String.valueOf(i));
}
Collections.sort(allowedCommands);
return this.filterTabResults(allowedCommands, args[args.length - 1]);
}