Skip to content

Commit

Permalink
fix: Empty suggestions con player subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d committed Apr 24, 2022
1 parent d477f7e commit 447eb3f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ private static LiteralCommandNode<CommandSource> playerCommand(String command, C
})
.then(RequiredArgumentBuilder
.<CommandSource, String>argument("player", StringArgumentType.word())
.suggests((ctx, builder) -> {
plugin.getChatPlayers().forEach((uuid, p) -> builder.suggest(p.username(), VelocityBrigadierMessage.tooltip(
plugin.getFormatter().parse(
Configuration.getMessages().getGeneralMessages().getPlayerSuggestionsFormat(),
p,
Placeholder.unparsed("player", p.username())
)
)));
return builder.buildFuture();
})
.executes(cmd -> {
String arg = cmd.getArgument("player", String.class);
CommandSource source = cmd.getSource();
Expand Down

0 comments on commit 447eb3f

Please sign in to comment.