From b01b2cce9bc9af5376100b243abf97578d4c24dd Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Mon, 12 Mar 2012 10:39:23 +0100 Subject: [PATCH] Added region/role-based permissions to /region teleport. --- .../sk89q/worldguard/bukkit/commands/RegionCommands.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/sk89q/worldguard/bukkit/commands/RegionCommands.java b/src/main/java/com/sk89q/worldguard/bukkit/commands/RegionCommands.java index d32c6e4b..e1a90374 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/commands/RegionCommands.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/commands/RegionCommands.java @@ -1072,6 +1072,15 @@ public void teleport(CommandContext args, CommandSender sender) throws CommandEx throw new CommandException("A region with ID '" + id + "' doesn't exist."); } + LocalPlayer localPlayer = plugin.wrapPlayer(player); + if (region.isOwner(localPlayer)) { + plugin.checkPermission(sender, "worldguard.region.teleport.own." + id.toLowerCase()); + } else if (region.isMember(localPlayer)) { + plugin.checkPermission(sender, "worldguard.region.teleport.member." + id.toLowerCase()); + } else { + 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.");