From f9d39271c019945769fcfe64c8967748afe49449 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Wed, 3 Aug 2011 21:47:49 -0500 Subject: [PATCH] Modified locutus' Pain feature so that all conf.json settings related to it default to false, so that the damage amount can be specified through "actionDeniedPainAmount" in conf.json, and so that DenyBuild doesn't override PainBuild but instead both will be used if both are enabled --- src/com/massivecraft/factions/Conf.java | 12 +++--- .../listeners/FactionsBlockListener.java | 37 ++++++++++--------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index 5aa1945c..9a95a8be 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -83,16 +83,18 @@ public class Conf { public static double considerFactionsReallyOfflineAfterXMinutes = 0.0; + public static int actionDeniedPainAmount = 1; + 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 territoryPainBuild = false; + public static boolean territoryPainBuildWhenOffline = false; 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 territoryEnemyPainBuild = false; + public static boolean territoryEnemyPainBuildWhenOffline = false; public static boolean territoryEnemyDenyUseage = true; public static boolean territoryEnemyProtectMaterials = true; public static boolean territoryBlockCreepers = false; @@ -108,7 +110,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 ownedAreaPainBuild = false; 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 08a76408..64849b53 100644 --- a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -185,36 +185,39 @@ public class FactionsBlockListener extends BlockListener { // Cancel if we are not in our own territory if (myFaction != otherFaction) { boolean online = otherFaction.hasPlayersOnline(); - if ( - (online && (areEnemies ? Conf.territoryEnemyDenyBuild : Conf.territoryDenyBuild)) - || (!online && (areEnemies ? Conf.territoryEnemyDenyBuildWhenOffline : Conf.territoryDenyBuildWhenOffline)) - ) { + boolean pain = (online && (areEnemies ? Conf.territoryEnemyPainBuild : Conf.territoryPainBuild)) + || (!online && (areEnemies ? Conf.territoryEnemyPainBuildWhenOffline : Conf.territoryPainBuildWhenOffline)); + boolean deny = (online && (areEnemies ? Conf.territoryEnemyDenyBuild : Conf.territoryDenyBuild)) + || (!online && (areEnemies ? Conf.territoryEnemyDenyBuildWhenOffline : Conf.territoryDenyBuildWhenOffline)); + //added by Bladedpenguin@gmail.com + //hurt the player for building/destroying? + if (pain) { + player.damage(Conf.actionDeniedPainAmount); + if (!deny) { + me.sendMessage("You are hurt for "+action+" in the territory of "+otherFaction.getTag(myFaction)); + } + } + if (deny) { 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 || Conf.ownedAreaPainBuild) && !myFaction.playerHasOwnershipRights(me, loc) && !Factions.hasPermOwnershipBypass(player) ) { + if (Conf.ownedAreaPainBuild){ + player.damage(Conf.actionDeniedPainAmount); + if (!Conf.ownedAreaDenyBuild) { + me.sendMessage("You are hurt for "+action+" in this territory, it is owned by: "+myFaction.getOwnerListString(loc)); + } + } 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); } }