Support listing players in a comma-separated list

This commit is contained in:
Phoenix616 2019-03-25 21:26:25 +01:00
parent f8a335a405
commit b9c1f02e2e

View File

@ -104,12 +104,14 @@ public class RandomTeleport extends JavaPlugin {
if (args.length > 0) {
List<Player> players = new ArrayList<>();
for (String arg : args) {
Player player = getServer().getPlayer(arg);
for (String s : arg.split(",")) {
Player player = getServer().getPlayer(s);
if (player == null) {
throw new PlayerNotFoundException(arg);
throw new PlayerNotFoundException(s);
}
players.add(player);
}
}
searcher.getTargets().addAll(players);
return true;
}