Fix entry and exit group flags not working, fix vehicle destroy flag not being allowed with canBuild

This commit is contained in:
zml2008 2012-03-03 16:26:11 -08:00
parent 8c8c162a54
commit 5ff2855eb0
2 changed files with 14 additions and 13 deletions

View File

@ -117,14 +117,14 @@ public void onPlayerMove(PlayerMoveEvent event) {
state = plugin.getFlagStateManager().getState(player); state = plugin.getFlagStateManager().getState(player);
} }
//LocalPlayer localPlayer = plugin.wrapPlayer(player); LocalPlayer localPlayer = plugin.wrapPlayer(player);
boolean hasBypass = plugin.getGlobalRegionManager().hasBypass(player, world); boolean hasBypass = plugin.getGlobalRegionManager().hasBypass(player, world);
RegionManager mgr = plugin.getGlobalRegionManager().get(world); RegionManager mgr = plugin.getGlobalRegionManager().get(world);
Vector pt = new Vector(event.getTo().getBlockX(), event.getTo().getBlockY(), event.getTo().getBlockZ()); Vector pt = new Vector(event.getTo().getBlockX(), event.getTo().getBlockY(), event.getTo().getBlockZ());
ApplicableRegionSet set = mgr.getApplicableRegions(pt); ApplicableRegionSet set = mgr.getApplicableRegions(pt);
boolean entryAllowed = set.allows(DefaultFlag.ENTRY);//, localPlayer); boolean entryAllowed = set.allows(DefaultFlag.ENTRY, localPlayer);
if (!hasBypass && !entryAllowed) { if (!hasBypass && !entryAllowed) {
player.sendMessage(ChatColor.DARK_RED + "You are not permitted to enter this area."); player.sendMessage(ChatColor.DARK_RED + "You are not permitted to enter this area.");
@ -139,10 +139,10 @@ public void onPlayerMove(PlayerMoveEvent event) {
// Have to set this state // Have to set this state
if (state.lastExitAllowed == null) { if (state.lastExitAllowed == null) {
state.lastExitAllowed = mgr.getApplicableRegions(toVector(event.getFrom())) state.lastExitAllowed = mgr.getApplicableRegions(toVector(event.getFrom()))
.allows(DefaultFlag.EXIT);//, localPlayer); .allows(DefaultFlag.EXIT, localPlayer);
} }
boolean exitAllowed = set.allows(DefaultFlag.EXIT);//, localPlayer); boolean exitAllowed = set.allows(DefaultFlag.EXIT, localPlayer);
if (!hasBypass && exitAllowed && !state.lastExitAllowed) { if (!hasBypass && exitAllowed && !state.lastExitAllowed) {
player.sendMessage(ChatColor.DARK_RED + "You are not permitted to leave this area."); player.sendMessage(ChatColor.DARK_RED + "You are not permitted to leave this area.");

View File

@ -63,6 +63,7 @@ public void onVehicleDestroy(VehicleDestroyEvent event) {
LocalPlayer localPlayer = plugin.wrapPlayer(player); LocalPlayer localPlayer = plugin.wrapPlayer(player);
if (!plugin.getGlobalRegionManager().hasBypass(player, world) if (!plugin.getGlobalRegionManager().hasBypass(player, world)
&& !set.canBuild(localPlayer)
&& !set.allows(DefaultFlag.DESTROY_VEHICLE, localPlayer)) { && !set.allows(DefaultFlag.DESTROY_VEHICLE, localPlayer)) {
player.sendMessage(ChatColor.DARK_RED + "You don't have permission to destroy vehicles here."); player.sendMessage(ChatColor.DARK_RED + "You don't have permission to destroy vehicles here.");
event.setCancelled(true); event.setCancelled(true);