From 451d9570e49e418e1277d99a6a9c0bca110a5c49 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Mon, 24 Oct 2011 14:54:37 +0200 Subject: [PATCH] The friendlyfire flag now works --- src/com/massivecraft/factions/Factions.java | 6 +++--- .../listeners/FactionsEntityListener.java | 15 ++++----------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java index d5eee1f9..768faeef 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/Factions.java @@ -110,7 +110,7 @@ public class Factions extends EntityCollection faction.setFlag(FFlag.MONSTERS, true); faction.setFlag(FFlag.EXPLOSIONS, true); faction.setFlag(FFlag.FIRESPREAD, true); - faction.setFlag(FFlag.LIGHTNING, true); + //faction.setFlag(FFlag.LIGHTNING, true); faction.setFlag(FFlag.ENDERGRIEF, true); faction.setPermittedRelations(FPerm.BUILD, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY); @@ -131,7 +131,7 @@ public class Factions extends EntityCollection faction.setFlag(FFlag.MONSTERS, false); faction.setFlag(FFlag.EXPLOSIONS, false); faction.setFlag(FFlag.FIRESPREAD, false); - faction.setFlag(FFlag.LIGHTNING, false); + //faction.setFlag(FFlag.LIGHTNING, false); faction.setFlag(FFlag.ENDERGRIEF, false); faction.setPermittedRelations(FPerm.DOOR, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY); @@ -151,7 +151,7 @@ public class Factions extends EntityCollection faction.setFlag(FFlag.MONSTERS, true); faction.setFlag(FFlag.EXPLOSIONS, true); faction.setFlag(FFlag.FIRESPREAD, true); - faction.setFlag(FFlag.LIGHTNING, true); + //faction.setFlag(FFlag.LIGHTNING, true); faction.setFlag(FFlag.ENDERGRIEF, true); faction.setPermittedRelations(FPerm.DOOR, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY); diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 1ec0071c..9b530919 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -65,12 +65,6 @@ public class FactionsEntityListener extends EntityListener fplayer.msg("Your power is now "+fplayer.getPowerRounded()+" / "+fplayer.getPowerMaxRounded()); } - /** - * Who can I hurt? - * I can never hurt members or allies. - * I can always hurt enemies. - * I can hurt neutrals as long as they are outside their own territory. - */ @Override public void onEntityDamage(EntityDamageEvent event) { @@ -146,7 +140,7 @@ public class FactionsEntityListener extends EntityListener if (damager instanceof Player) { FPlayer attacker = FPlayers.i.get((Player)damager); - attacker.msg("You can't hurt other players here."); + attacker.msg("PVP is disabled in %s.", defLocFaction.describeTo(attacker)); return false; } return defLocFaction.getFlag(FFlag.MONSTERS); @@ -175,7 +169,7 @@ public class FactionsEntityListener extends EntityListener // so we know from above that the defender isn't in a safezone... what about the attacker, sneaky dog that he might be? if (locFaction.getFlag(FFlag.PVP) == false) { - attacker.msg("You can't hurt other players here."); + attacker.msg("PVP is disabled in %s.", locFaction.describeTo(attacker)); return false; } @@ -204,15 +198,14 @@ public class FactionsEntityListener extends EntityListener Rel relation = defendFaction.getRelationTo(attackFaction); // Check the relation - if (relation.isAtLeast(Conf.friendlyFireFromRel)) + if (relation.isAtLeast(Conf.friendlyFireFromRel) && defLocFaction.getFlag(FFlag.FRIENDLYFIRE) == false) { attacker.msg("You can't hurt %s.", relation.getDescPlayerMany()); return false; } - boolean ownTerritory = defender.isInOwnTerritory(); - // You can not hurt neutrals in their own territory. + boolean ownTerritory = defender.isInOwnTerritory(); if (ownTerritory && relation == Rel.NEUTRAL) { attacker.msg("You can't hurt %s in their own territory unless you declare them as an enemy.", defender.describeTo(attacker));