Skip to content

Commit

Permalink
[FIX] checking of incoming length for tab completion
Browse files Browse the repository at this point in the history
  • Loading branch information
das-kaesebrot committed Mar 9, 2023
1 parent 219c1e6 commit c5cc80b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
if (!(sender instanceof Player player))
return List.of();

if (args.length == 0) {
if (args.length == 1) {
if (player.hasPermission(PERMISSION_LIST)) suggestedArgs.add(SUBCOMMAND_LIST);
if (player.hasPermission(PERMISSION_ADD)) suggestedArgs.add(SUBCOMMAND_ADD);
if (player.hasPermission(PERMISSION_REMOVE)) suggestedArgs.add(SUBCOMMAND_REMOVE);
if (player.hasPermission(PERMISSION_RELOAD)) suggestedArgs.add(SUBCOMMAND_RELOAD);

return suggestedArgs;

} else if (args.length == 1) {
} else if (args.length == 2) {
switch (args[0]) {
case SUBCOMMAND_REMOVE:
if (player.hasPermission(PERMISSION_REMOVE)) {
Expand Down

0 comments on commit c5cc80b

Please sign in to comment.