/tpregion now checks for flag rights

This commit is contained in:
Redecouverte 2011-02-26 01:18:50 +01:00
parent 7bedf6bb15
commit a473f47235
2 changed files with 22 additions and 0 deletions

View File

@ -51,6 +51,7 @@ worldguard.region.claim
worldguard.tpregion
worldguard.tpregion.spawn
worldguard.tpregion.override
worldguard.buyregion

View File

@ -3,6 +3,8 @@
*/
package com.sk89q.worldguard.bukkit.commands;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.bukkit.BukkitPlayer;
import com.sk89q.worldguard.bukkit.WorldGuardConfiguration;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -39,6 +41,25 @@ public boolean handle(CommandSender sender, String senderName, String command, S
RegionManager mgr = cfg.getWorldGuardPlugin().getGlobalRegionManager().getRegionManager(player.getWorld().getName());
ProtectedRegion region = mgr.getRegion(id);
if (region != null) {
String flagright = "all";
if (spawn) {
flagright = region.getFlags().getFlag("spawn", "settings");
} else {
flagright = region.getFlags().getFlag("teleport", "settings");
}
LocalPlayer lPlayer = BukkitPlayer.wrapPlayer(cfg, player);
if (flagright.equals("owner")) {
if (!region.isOwner(lPlayer)) {
cfg.checkPermission(player, "tpregion.override");
}
} else if (flagright.equals("meber")) {
if (!region.isMember(lPlayer)) {
cfg.checkPermission(player, "tpregion.override");
}
}
Location location = null;
if (spawn) {