mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-08-08 23:35:26 +02:00
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
This commit is contained in:
@@ -177,8 +177,14 @@ public class Grant extends Command {
|
|||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user