From 768f96bf9bc9d3bcc75f66cdbf223c0d2c5c4965 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sun, 19 Jun 2011 03:49:46 -0500 Subject: [PATCH] added option "disablePVPForFactionlessPlayers" to disable PvP damage to/from players who are not in a faction --- src/org/mcteam/factions/Conf.java | 2 ++ .../factions/listeners/FactionsEntityListener.java | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/org/mcteam/factions/Conf.java b/src/org/mcteam/factions/Conf.java index 708e5bc6..292f9245 100644 --- a/src/org/mcteam/factions/Conf.java +++ b/src/org/mcteam/factions/Conf.java @@ -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; diff --git a/src/org/mcteam/factions/listeners/FactionsEntityListener.java b/src/org/mcteam/factions/listeners/FactionsEntityListener.java index 59ede7c6..08adbef2 100644 --- a/src/org/mcteam/factions/listeners/FactionsEntityListener.java +++ b/src/org/mcteam/factions/listeners/FactionsEntityListener.java @@ -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?