From b9c1f02e2e50032695b93bf951cb0712495510c0 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Mon, 25 Mar 2019 21:26:25 +0100 Subject: [PATCH] Support listing players in a comma-separated list --- .../java/de/themoep/randomteleport/RandomTeleport.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/randomteleport-plugin/src/main/java/de/themoep/randomteleport/RandomTeleport.java b/randomteleport-plugin/src/main/java/de/themoep/randomteleport/RandomTeleport.java index c171f62..12c7ec0 100644 --- a/randomteleport-plugin/src/main/java/de/themoep/randomteleport/RandomTeleport.java +++ b/randomteleport-plugin/src/main/java/de/themoep/randomteleport/RandomTeleport.java @@ -104,11 +104,13 @@ public class RandomTeleport extends JavaPlugin { if (args.length > 0) { List players = new ArrayList<>(); for (String arg : args) { - Player player = getServer().getPlayer(arg); - if (player == null) { - throw new PlayerNotFoundException(arg); + for (String s : arg.split(",")) { + Player player = getServer().getPlayer(s); + if (player == null) { + throw new PlayerNotFoundException(s); + } + players.add(player); } - players.add(player); } searcher.getTargets().addAll(players); return true;