mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-22 02:25:38 +01:00
Add ability to select random world in -world parameter
This commit is contained in:
parent
11cbc0abb8
commit
f934071367
@ -24,7 +24,7 @@ Usage | Description
|
||||
Option | Description
|
||||
--------------------------------|-------------------------------------------
|
||||
`-p,-player <playername>` | teleports other players
|
||||
`-w,-world <worldname>` | teleports the player in a specific world
|
||||
`-w,-world <world1,world2,...>` | teleports the player in a specific or random world
|
||||
`-b,-biome <biomename...>` | only teleport to this biome (multiple allowed, Bukkit biome names!)
|
||||
`-x,-xPos <x value>` | x axis of the center point, if not set the player's x axis is used
|
||||
`-z,-zPos <z value>` | z axis of the center point, if not set the player's z axis is used
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user