From aaa56ec40a103f02703283a3b8c03781f32d3ec5 Mon Sep 17 00:00:00 2001 From: Amrac Date: Thu, 28 Jul 2011 16:04:11 +0200 Subject: [PATCH] New setting in conf.json: "disablePVPBetweenNeutralFaction": false whether PvP damage will be disabled between neutral faction Change-Id: I08eee177fbe69d1466a267e67ec3fd0389f83499 --- src/com/massivecraft/factions/Conf.java | 1 + .../factions/listeners/FactionsEntityListener.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index e89f0ca9..db8426ee 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -71,6 +71,7 @@ public class Conf { public static double homesTeleportAllowedEnemyDistance = 32; public static boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true; + public static boolean disablePVPBetweenNeutralFaction = false; public static boolean disablePVPForFactionlessPlayers = false; public static int noPVPDamageToOthersForXSecondsAfterLogin = 3; diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 1c34a556..1346a41d 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -188,6 +188,12 @@ public class FactionsEntityListener extends EntityListener { Relation relation = defender.getRelation(attacker); + // You can not hurt neutral factions + if (relation.isNeutral() && Conf.disablePVPBetweenNeutralFaction) { + attacker.sendMessage("You can't hurt neutral factions"); + return false; + } + // Players without faction may be hurt anywhere if (defender.getFaction().isNone()) { return true;