diff --git a/src/main/java/de/strifel/VTools/commands/CommandSend.java b/src/main/java/de/strifel/VTools/commands/CommandSend.java index def1c11..c4d8ba6 100644 --- a/src/main/java/de/strifel/VTools/commands/CommandSend.java +++ b/src/main/java/de/strifel/VTools/commands/CommandSend.java @@ -104,16 +104,19 @@ public class CommandSend implements SimpleCommand { String[] currentArgs = invocation.arguments(); switch (currentArgs.length) { case 0, 1 -> { - List arg = new ArrayList<>(server.getPlayerCount() + 2); - arg.add("all"); - arg.add("current"); + List args = new ArrayList<>(server.getPlayerCount() + 2); + args.add("all"); + args.add("current"); for (Player player : server.getAllPlayers()) { - arg.add(player.getUsername()); + args.add(player.getUsername()); } - return arg; + return currentArgs.length==0?args: + args.stream().filter(arg->arg.regionMatches(true,0,currentArgs[0],0,currentArgs[0].length())).toList(); } case 2 -> { - return server.getAllServers().stream().map(s -> s.getServerInfo().getName()).toList(); + return server.getAllServers().stream().map(s -> s.getServerInfo().getName()) + .filter(name -> name.regionMatches(true, 0, currentArgs[1], 0, currentArgs[1].length())) + .toList(); } default -> { return new ArrayList<>(0);