diff --git a/README.md b/README.md index 64fc476..f3904d1 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Usage | Description Option | Description --------------------------------|------------------------------------------- `-p,-player ` | teleports other players -`-w,-world ` | teleports the player in a specific world +`-w,-world ` | teleports the player in a specific or random world `-b,-biome ` | only teleport to this biome (multiple allowed, Bukkit biome names!) `-x,-xPos ` | x axis of the center point, if not set the player's x axis is used `-z,-zPos ` | z axis of the center point, if not set the player's z axis is used 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 524e4bd..ccfcfe8 100644 --- a/randomteleport-plugin/src/main/java/de/themoep/randomteleport/RandomTeleport.java +++ b/randomteleport-plugin/src/main/java/de/themoep/randomteleport/RandomTeleport.java @@ -183,9 +183,11 @@ public class RandomTeleport extends JavaPlugin implements RandomTeleportAPI { })); addOptionParser(new SimpleOptionParser(array("w", "world"), (searcher, args) -> { if (args.length > 0) { - World world = getServer().getWorld(args[0]); + String[] worldNames = args[0].split(","); + String worldName = worldNames[searcher.getRandom().nextInt(worldNames.length)]; + World world = getServer().getWorld(worldName); if (world == null) { - throw new WorldNotFoundException(args[0]); + throw new WorldNotFoundException(worldName); } searcher.setWorld(world); return true;