Skip to content

Commit 4d2e4a3

Browse files
authored
fix: tab completion for /plot grant add/check <name> commands (#4720)
Fix tab completion for /plot grant add/check <name> commands Fixed an issue where player name tab completion was not working correctly for /plot grant add <name> and /plot grant check <name> commands. Previously, the tab completion logic would only attempt to complete player names after all arguments were processed, making it impossible to get player suggestions when typing the second argument. Now the completion properly handles: - /plot grant <TAB> → shows "add", "check" subcommands - /plot grant add <TAB> → shows player list - /plot grant check <TAB> → shows player list Fixes #4382
1 parent e5d3657 commit 4d2e4a3

File tree

1 file changed

+7
-1
lines changed
  • Core/src/main/java/com/plotsquared/core/command

1 file changed

+7
-1
lines changed

Core/src/main/java/com/plotsquared/core/command/Grant.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,14 @@ public Collection<Command> tab(final PlotPlayer<?> player, final String[] args,
177177
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
178178
}
179179
return commands;
180+
} else if (args.length == 2) {
181+
final String subcommand = args[0].toLowerCase();
182+
if ((subcommand.equals("add") && player.hasPermission(Permission.PERMISSION_GRANT_ADD)) ||
183+
(subcommand.equals("check") && player.hasPermission(Permission.PERMISSION_GRANT_CHECK))) {
184+
return TabCompletions.completePlayers(player, args[1], Collections.emptyList());
185+
}
180186
}
181-
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
187+
return Collections.emptyList();
182188
}
183189

184190
}

0 commit comments

Comments
 (0)