From 60abb61cb952147401610777fe044f1f2517eaf1 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Thu, 22 Sep 2011 16:12:35 -0500 Subject: [PATCH] Fix for "territoryEnemyProtectMaterials" and "territoryAllyProtectMaterials" not working correctly, and wrong protection message being sent to neutral players. Re-jiggered the related code a bit which handles such things based on enemy/ally/member/neutral status. --- .../factions/listeners/FactionsBlockListener.java | 3 +-- .../factions/listeners/FactionsEntityListener.java | 2 +- .../factions/listeners/FactionsPlayerListener.java | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java index ed22ac05..99d35bed 100644 --- a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -206,8 +206,7 @@ public class FactionsBlockListener extends BlockListener { } } // Also cancel and/or cause pain if player doesn't have ownership rights for this claim - if (ownershipFail && !Factions.hasPermOwnershipBypass(player) - ) { + else if (rel.isMember() && ownershipFail && !Factions.hasPermOwnershipBypass(player)) { if (Conf.ownedAreaPainBuild){ player.damage(Conf.actionDeniedPainAmount); if (!Conf.ownedAreaDenyBuild) { diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 3b1a8bc2..687e347f 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -384,7 +384,7 @@ public class FactionsEntityListener extends EntityListener { return false; } // Also cancel if player doesn't have ownership rights for this claim - else if (ownershipFail && (!rel.isMember() || !Factions.hasPermOwnershipBypass(player))) { + else if (rel.isMember() && ownershipFail && !Factions.hasPermOwnershipBypass(player)) { me.sendMessage("You can't "+action+" paintings in this territory, it is owned by: "+otherFaction.getOwnerListString(loc)); return false; } diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index cd66a0fc..f54e392c 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -332,7 +332,7 @@ public class FactionsPlayerListener extends PlayerListener{ return false; } // Also cancel if player doesn't have ownership rights for this claim - else if (ownershipFail && (!rel.isMember() || !Factions.hasPermOwnershipBypass(player))) { + else if (rel.isMember() && ownershipFail && !Factions.hasPermOwnershipBypass(player)) { me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in this territory, it is owned by: "+myFaction.getOwnerListString(loc)); return false; } @@ -372,12 +372,12 @@ public class FactionsPlayerListener extends PlayerListener{ boolean ownershipFail = Conf.ownedAreasEnabled && Conf.ownedAreaProtectMaterials && !otherFaction.playerHasOwnershipRights(me, loc); // You may use any block unless it is another faction's territory... - if ((rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials)) { + if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials)) { me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in the territory of "+otherFaction.getTag(myFaction)); return false; } // Also cancel if player doesn't have ownership rights for this claim - else if (ownershipFail && (!rel.isMember() || !Factions.hasPermOwnershipBypass(player))) { + else if (rel.isMember() && ownershipFail && !Factions.hasPermOwnershipBypass(player)) { me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in this territory, it is owned by: "+myFaction.getOwnerListString(loc)); return false; }