added option "disablePVPForFactionlessPlayers" to disable PvP damage to/from players who are not in a faction

This commit is contained in:
Brettflan 2011-06-19 03:49:46 -05:00
parent e886cef9aa
commit 768f96bf9b
2 changed files with 11 additions and 0 deletions

View File

@ -64,6 +64,8 @@ public class Conf {
public static boolean homesTeleportToOnDeath = true;
public static double homesTeleportAllowedEnemyDistance = 32;
public static boolean disablePVPForFactionlessPlayers = false;
public static double territoryShieldFactor = 0.3;
public static boolean territoryDenyBuild = true;
public static boolean territoryDenyBuildWhenOffline = true;

View File

@ -160,6 +160,15 @@ public class FactionsEntityListener extends EntityListener {
return true;
}
if (!attacker.hasFaction() && Conf.disablePVPForFactionlessPlayers) {
attacker.sendMessage("You can't hurt other players until you join a faction.");
return false;
}
else if (!defender.hasFaction() && Conf.disablePVPForFactionlessPlayers) {
attacker.sendMessage("You can't hurt players who are not currently in a faction.");
return false;
}
Faction locFaction = Board.getFactionAt(new FLocation(attacker));
// so we know from above that the defender isn't in a safezone... what about the attacker, sneaky dog that he might be?