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

This commit is contained in:
Brettflan 2011-08-03 21:47:49 -05:00
parent e02abf3380
commit f9d39271c0
2 changed files with 27 additions and 22 deletions

View File

@ -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;

View File

@ -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);
}
}