Skip to content

Commit

Permalink
Don't tab-complete callback
Browse files Browse the repository at this point in the history
  • Loading branch information
rymiel committed Feb 10, 2024
1 parent 8c9018a commit 27cf2e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion bukkit/src/main/java/org/popcraft/bolt/BoltPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Comman
final String commandKey = (isBoltCommand ? args[0] : command.getName()).toLowerCase();
final List<String> suggestions = new ArrayList<>();
if (args.length == commandStart) {
commands.keySet().stream().filter(name -> sender.hasPermission(COMMAND_PERMISSION_KEY + name)).forEach(suggestions::add);
commands.entrySet().stream()
.filter(i -> sender.hasPermission(COMMAND_PERMISSION_KEY + i.getKey()) && !i.getValue().hidden())
.forEach(i -> suggestions.add(i.getKey()));
} else if (commands.containsKey(commandKey) && sender.hasPermission(COMMAND_PERMISSION_KEY + commandKey)) {
suggestions.addAll(commands.get(commandKey).suggestions(sender, new Arguments(Arrays.copyOfRange(args, commandStart, args.length))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ protected BoltCommand(BoltPlugin plugin) {
public abstract void shortHelp(CommandSender sender, Arguments arguments);

public abstract void longHelp(CommandSender sender, Arguments arguments);

public boolean hidden() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ public List<String> suggestions(CommandSender sender, Arguments arguments) {

@Override
public void shortHelp(CommandSender sender, Arguments arguments) {
// idk
// No help
}

@Override
public void longHelp(CommandSender sender, Arguments arguments) {
// idk
// No help
}

@Override
public boolean hidden() {
return true;
}
}

0 comments on commit 27cf2e4

Please sign in to comment.