Added region/role-based permissions to /region teleport.

This commit is contained in:
TomyLobo 2012-03-12 10:39:23 +01:00
parent c5b1089c96
commit b01b2cce9b

View File

@ -1072,6 +1072,15 @@ public void teleport(CommandContext args, CommandSender sender) throws CommandEx
throw new CommandException("A region with ID '" + id + "' doesn't exist."); 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); final Location teleportLocation = region.getFlag(DefaultFlag.TELE_LOC);
if (teleportLocation == null) { if (teleportLocation == null) {
throw new CommandException("The region has no teleport point associated."); throw new CommandException("The region has no teleport point associated.");