diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/GlistCommand.java b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/GlistCommand.java index 5d2f19fea0..0bfc0f0745 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/GlistCommand.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/GlistCommand.java @@ -66,10 +66,18 @@ public void register() { ArgumentCommandNode serverNode = RequiredArgumentBuilder .argument(SERVER_ARG, StringArgumentType.string()) .suggests((context, builder) -> { + String argument = context.getArguments().containsKey(SERVER_ARG) + ? context.getArgument(SERVER_ARG, String.class) + : ""; for (RegisteredServer server : server.getAllServers()) { - builder.suggest(server.getServerInfo().getName()); + String serverName = server.getServerInfo().getName(); + if (serverName.regionMatches(true, 0, argument, 0, argument.length())) { + builder.suggest(serverName); + } + } + if ("all".regionMatches(true, 0, argument, 0, argument.length())) { + builder.suggest("all"); } - builder.suggest("all"); return builder.buildFuture(); }) .executes(this::serverCount) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/SendCommand.java b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/SendCommand.java index bf07e8a4cf..555716130d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/SendCommand.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/SendCommand.java @@ -56,21 +56,35 @@ public void register() { .executes(this::usage) .build(); ArgumentCommandNode playerNode = RequiredArgumentBuilder - .argument("player", StringArgumentType.word()) + .argument(PLAYER_ARG, StringArgumentType.word()) .suggests((context, builder) -> { + String argument = context.getArguments().containsKey(PLAYER_ARG) + ? context.getArgument(PLAYER_ARG, String.class) + : ""; for (Player player : server.getAllPlayers()) { - builder.suggest(player.getUsername()); + String playerName = player.getUsername(); + if (playerName.regionMatches(true, 0, argument, 0, argument.length())) { + builder.suggest(playerName); + } + } + if ("all".regionMatches(true, 0, argument, 0, argument.length())) { + builder.suggest("all"); } - builder.suggest("all"); return builder.buildFuture(); }) .executes(this::usage) .build(); ArgumentCommandNode serverNode = RequiredArgumentBuilder - .argument("server", StringArgumentType.word()) + .argument(SERVER_ARG, StringArgumentType.word()) .suggests((context, builder) -> { + String argument = context.getArguments().containsKey(SERVER_ARG) + ? context.getArgument(SERVER_ARG, String.class) + : ""; for (RegisteredServer server : server.getAllServers()) { - builder.suggest(server.getServerInfo().getName()); + String serverName = server.getServerInfo().getName(); + if (serverName.regionMatches(true, 0, argument, 0, argument.length())) { + builder.suggest(serverName); + } } return builder.buildFuture(); })