Add ability to select random preset

This commit is contained in:
Phoenix616 2023-03-16 16:48:59 +01:00
parent f934071367
commit 34fc5c3439
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
3 changed files with 5 additions and 4 deletions

View File

@ -16,7 +16,7 @@ Permission: `randomteleport.use`
Usage | Description Usage | Description
--------------------------------------------|------------------------------- --------------------------------------------|-------------------------------
`/rtp` | uses the default preset `/rtp` | uses the default preset
`/rtp <preset> [<playername>]` | uses a specific preset `/rtp <preset1,...> [<playername>]` | uses a specific or random preset
`/rtp <minRange> <maxRange> [<options>]` | `minRange` - minimum distance to the center point (square shaped) <br> `maxRange` - maximum distance to the center point (square shaped) `/rtp <minRange> <maxRange> [<options>]` | `minRange` - minimum distance to the center point (square shaped) <br> `maxRange` - maximum distance to the center point (square shaped)
`/rtp --stat` | shows a statistic of the teleports since the last restart `/rtp --stat` | shows a statistic of the teleports since the last restart
`/rtp --reload` | reloads the config `/rtp --reload` | reloads the config

View File

@ -78,7 +78,8 @@ public class RandomTeleportCommand implements CommandExecutor {
plugin.sendMessage(sender, "error.player-not-found", "what", args[1]); plugin.sendMessage(sender, "error.player-not-found", "what", args[1]);
return true; return true;
} }
runPreset(args[0].toLowerCase(), sender, target, target.getLocation()); String[] presets = args[0].split(",");
runPreset(presets[RandomTeleport.RANDOM.nextInt(presets.length)].toLowerCase(), sender, target, target.getLocation());
return true; return true;
} }
sender.sendMessage(e.getMessage()); sender.sendMessage(e.getMessage());

View File

@ -14,13 +14,13 @@ commands:
permission: randomteleport.use permission: randomteleport.use
usage: | usage: |
/<command> - uses the default preset /<command> - uses the default preset
/<command> <preset> [<playername>] - uses a specific preset /<command> <preset1,...> [<playername>] - uses a specific or random preset
/<command> <minRange> <maxRange> [-p, -w, -x, -z, -c, -f] /<command> <minRange> <maxRange> [-p, -w, -x, -z, -c, -f]
minRange - minimum distance to the center point (square shaped) minRange - minimum distance to the center point (square shaped)
maxRange - maximum distance to the center point (square shaped) maxRange - maximum distance to the center point (square shaped)
Options: Options:
> -p,-player <playername> - teleports other players > -p,-player <playername> - teleports other players
> -w,-world <worldname> - teleports the player in a specific world > -w,-world <world1,...> - teleports the player in a specific or random world
> -b,-biome <biomename> [<biome 2> ...] - only teleport to this biome (multiple allowed, Bukkit biome names!) > -b,-biome <biomename> [<biome 2> ...] - 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 > -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 > -z,-zPos <z value> - z axis of the center point, if not set the player's z axis is used