mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-19 15:48:10 +01:00
Added a -s flag to /region teleport, which sends you to the spawn point instead of the teleport point of a region.
This commit is contained in:
parent
b01b2cce9b
commit
88d79a42e6
@ -1055,7 +1055,7 @@ public void migratedb(CommandContext args, CommandSender sender) throws CommandE
|
||||
"If you wish to use the destination format as your new backend, please update your config and reload WorldGuard.");
|
||||
}
|
||||
|
||||
@Command(aliases = {"teleport", "tp"}, usage = "<id>",
|
||||
@Command(aliases = {"teleport", "tp"}, usage = "<id>", flags = "s",
|
||||
desc = "Teleports you to the location associated with the region.", min = 1, max = 1)
|
||||
@CommandPermissions({"worldguard.region.teleport"})
|
||||
public void teleport(CommandContext args, CommandSender sender) throws CommandException {
|
||||
@ -1081,9 +1081,17 @@ public void teleport(CommandContext args, CommandSender sender) throws CommandEx
|
||||
plugin.checkPermission(sender, "worldguard.region.teleport." + id.toLowerCase());
|
||||
}
|
||||
|
||||
final Location teleportLocation = region.getFlag(DefaultFlag.TELE_LOC);
|
||||
if (teleportLocation == null) {
|
||||
throw new CommandException("The region has no teleport point associated.");
|
||||
final Location teleportLocation;
|
||||
if (args.hasFlag('s')) {
|
||||
teleportLocation = region.getFlag(DefaultFlag.SPAWN_LOC);
|
||||
if (teleportLocation == null) {
|
||||
throw new CommandException("The region has no spawn point associated.");
|
||||
}
|
||||
} else {
|
||||
teleportLocation = region.getFlag(DefaultFlag.TELE_LOC);
|
||||
if (teleportLocation == null) {
|
||||
throw new CommandException("The region has no teleport point associated.");
|
||||
}
|
||||
}
|
||||
|
||||
player.teleport(BukkitUtil.toLocation(teleportLocation));
|
||||
|
Loading…
Reference in New Issue
Block a user