From 51a05a1e86f970b2ed1e806768414442c041f513 Mon Sep 17 00:00:00 2001 From: locutus Date: Wed, 3 Aug 2011 02:29:51 -0400 Subject: [PATCH] Added Territory Pain Protection added options ownedAreaPainBuild territoryPainBuild territoryPainBuildWhenOffline territoryEnemyPainBuild territoryEnemyPainBuildWhenOffline Signed-off-by: locutus --- src/com/massivecraft/factions/Conf.java | 5 +++++ .../listeners/FactionsBlockListener.java | 20 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index 2df337d1..5aa1945c 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -86,9 +86,13 @@ public class Conf { public static double territoryShieldFactor = 0.3; public static boolean territoryDenyBuild = true; public static boolean territoryDenyBuildWhenOffline = true; + public static boolean territoryPainBuild = true; + public static boolean territoryPainBuildWhenOffline = true; public static boolean territoryDenyUseage = true; public static boolean territoryEnemyDenyBuild = true; public static boolean territoryEnemyDenyBuildWhenOffline = true; + public static boolean territoryEnemyPainBuild = true; + public static boolean territoryEnemyPainBuildWhenOffline = true; public static boolean territoryEnemyDenyUseage = true; public static boolean territoryEnemyProtectMaterials = true; public static boolean territoryBlockCreepers = false; @@ -104,6 +108,7 @@ public class Conf { public static boolean ownedAreasModeratorsCanSet = false; public static boolean ownedAreaModeratorsBypass = true; public static boolean ownedAreaDenyBuild = true; + public static boolean ownedAreaPainBuild = true; public static boolean ownedAreaProtectMaterials = true; public static boolean ownedAreaDenyUseage = true; diff --git a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java index d258f924..08a76408 100644 --- a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -192,16 +192,30 @@ public class FactionsBlockListener extends BlockListener { me.sendMessage("You can't "+action+" in the territory of "+otherFaction.getTag(myFaction)); return false; } + //added by Bladedpenguin@gmail.com + //if not denybuild, hurt the player for building? + else if ( + (online && (areEnemies ? Conf.territoryEnemyPainBuild : Conf.territoryPainBuild)) + || (!online && (areEnemies ? Conf.territoryEnemyPainBuildWhenOffline : Conf.territoryPainBuildWhenOffline)) + ) { + me.sendMessage("You are hurt for "+action+" in the territory of "+otherFaction.getTag(myFaction)); + player.damage(1); + } } // Also cancel if player doesn't have ownership rights for this claim + // Also restructured by bladedpenguin/locutus else if ( Conf.ownedAreasEnabled - && Conf.ownedAreaDenyBuild && !myFaction.playerHasOwnershipRights(me, loc) && !Factions.hasPermOwnershipBypass(player) ) { - me.sendMessage("You can't "+action+" in this territory, it is owned by: "+myFaction.getOwnerListString(loc)); - return false; + if (Conf.ownedAreaDenyBuild){ + me.sendMessage("You can't "+action+" in this territory, it is owned by: "+myFaction.getOwnerListString(loc)); + return false; + } else if (Conf.ownedAreaPainBuild){ + me.sendMessage("You are hurt for "+action+" in this territory, it is owned by: "+myFaction.getOwnerListString(loc)); + player.damage(1); + } } return true;