From e886cef9aa48611505955ffe97014c49526fc1b7 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Thu, 16 Jun 2011 02:37:05 -0500 Subject: [PATCH] Fix for DenyUsage checks in safe zones and war zones not being handled properly --- .../factions/listeners/FactionsBlockListener.java | 7 +++---- .../factions/listeners/FactionsPlayerListener.java | 11 ++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/org/mcteam/factions/listeners/FactionsBlockListener.java b/src/org/mcteam/factions/listeners/FactionsBlockListener.java index 3f941103..abacd284 100644 --- a/src/org/mcteam/factions/listeners/FactionsBlockListener.java +++ b/src/org/mcteam/factions/listeners/FactionsBlockListener.java @@ -74,16 +74,15 @@ public class FactionsBlockListener extends BlockListener { me.sendMessage("You can't "+action+" in the wilderness."); return false; } - - if (otherFaction.isSafeZone()) { - if (Factions.hasPermManageSafeZone(player) || !Conf.safeZoneDenyBuild) { + else if (otherFaction.isSafeZone()) { + if (!Conf.safeZoneDenyBuild || Factions.hasPermManageSafeZone(player)) { return true; } me.sendMessage("You can't "+action+" in a safe zone."); return false; } else if (otherFaction.isWarZone()) { - if (Factions.hasPermManageWarZone(player) || !Conf.warZoneDenyBuild) { + if (!Conf.warZoneDenyBuild || Factions.hasPermManageWarZone(player)) { return true; } me.sendMessage("You can't "+action+" in a war zone."); diff --git a/src/org/mcteam/factions/listeners/FactionsPlayerListener.java b/src/org/mcteam/factions/listeners/FactionsPlayerListener.java index 681bd19c..0c4f73c6 100644 --- a/src/org/mcteam/factions/listeners/FactionsPlayerListener.java +++ b/src/org/mcteam/factions/listeners/FactionsPlayerListener.java @@ -233,8 +233,6 @@ public class FactionsPlayerListener extends PlayerListener{ return; // only interested on right-clicks for below } - // this check below might no longer be needed... bucket detection is now necessarily handled separately in onPlayerBucketXXX() events, and - // Flint&Steel is somehow detected before this in onBlockPlace(), and that's currently it for the default territoryDenyUseageMaterials if ( ! this.playerCanUseItemHere(player, block, event.getMaterial())) { event.setCancelled(true); return; @@ -268,16 +266,15 @@ public class FactionsPlayerListener extends PlayerListener{ me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in the wilderness."); return false; } - - if (otherFaction.isSafeZone() && Conf.safeZoneDenyUseage) { - if (Factions.hasPermManageSafeZone(player)) { + else if (otherFaction.isSafeZone()) { + if (!Conf.safeZoneDenyUseage || Factions.hasPermManageSafeZone(player)) { return true; } me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in a safe zone."); return false; } - else if (otherFaction.isWarZone() && Conf.warZoneDenyUseage) { - if (Factions.hasPermManageWarZone(player)) { + else if (otherFaction.isWarZone()) { + if (!Conf.warZoneDenyUseage || Factions.hasPermManageWarZone(player)) { return true; } me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in a war zone.");