From 92448ca4d28bb852e1b3edc45a0609abc8ab287b Mon Sep 17 00:00:00 2001 From: Brettflan Date: Mon, 1 Aug 2011 20:22:16 -0500 Subject: [PATCH] New conf.json setting "worldsIgnorePvP" as a list of worlds which you don't want Factions to pay any attention to PvP in. No new command has been added to set this, since we now have the /f config command. So, to add/remove worlds, simply use /f config worldsIgnorePvP [YourWorldHere]. --- src/com/massivecraft/factions/Conf.java | 1 + .../factions/listeners/FactionsEntityListener.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index f510b31d..2df337d1 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -164,6 +164,7 @@ public class Conf { public static Set worldsNoClaiming = new HashSet(); public static Set worldsNoPowerLoss = new HashSet(); + public static Set worldsIgnorePvP = new HashSet(); public static transient int mapHeight = 8; public static transient int mapWidth = 39; diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 3c4e41de..0fabadb3 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.listeners; import java.text.MessageFormat; import org.bukkit.ChatColor; +import org.bukkit.Location; import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.Fireball; @@ -153,12 +154,17 @@ public class FactionsEntityListener extends EntityListener { return true; } + Location defenderLoc = defender.getPlayer().getLocation(); + + if (Conf.worldsIgnorePvP.contains(defenderLoc.getWorld().getName())) { + return true; + } + // Players can not take attack damage in a SafeZone - if (Board.getFactionAt(new FLocation(defender)).isSafeZone()) { + if (Board.getFactionAt(new FLocation(defenderLoc)).isSafeZone()) { if (damager instanceof Player) { FPlayer attacker = FPlayer.get((Player)damager); attacker.sendMessage("You can't hurt other players in a SafeZone."); -// defender.sendMessage(attacker.getNameAndRelevant(defender)+Conf.colorSystem+" tried to hurt you."); } return false; } @@ -237,6 +243,7 @@ public class FactionsEntityListener extends EntityListener { return true; } + @Override public void onCreatureSpawn(CreatureSpawnEvent event) { if (event.isCancelled()) { return;