From 4d2e4a3d1a1d2c7e601a729d2abdcf6910ddc02e Mon Sep 17 00:00:00 2001 From: Leviaria <113382526+Leviaria@users.noreply.github.com> Date: Wed, 6 Aug 2025 21:44:10 +0200 Subject: [PATCH] fix: tab completion for /plot grant add/check commands (#4720) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix tab completion for /plot grant add/check commands Fixed an issue where player name tab completion was not working correctly for /plot grant add and /plot grant check 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 → shows "add", "check" subcommands - /plot grant add → shows player list - /plot grant check → shows player list Fixes #4382 --- .../src/main/java/com/plotsquared/core/command/Grant.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Grant.java b/Core/src/main/java/com/plotsquared/core/command/Grant.java index e79f04604..18db0c77d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Grant.java +++ b/Core/src/main/java/com/plotsquared/core/command/Grant.java @@ -177,8 +177,14 @@ public class Grant extends Command { commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList())); } return commands; + } else if (args.length == 2) { + final String subcommand = args[0].toLowerCase(); + if ((subcommand.equals("add") && player.hasPermission(Permission.PERMISSION_GRANT_ADD)) || + (subcommand.equals("check") && player.hasPermission(Permission.PERMISSION_GRANT_CHECK))) { + return TabCompletions.completePlayers(player, args[1], Collections.emptyList()); + } } - return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList()); + return Collections.emptyList(); } }