self-inflicted damage (such as ender pearl usage) is no longer prevented with a message like "you cannot hurt you"

This commit is contained in:
Brettflan 2012-01-17 02:56:38 -06:00
parent 8142e1c28f
commit 46d7e9f4c5

View File

@ -163,24 +163,21 @@ public class FactionsEntityListener extends EntityListener
FPlayer defender = FPlayers.i.get((Player)damagee); FPlayer defender = FPlayers.i.get((Player)damagee);
if (defender == null || defender.getPlayer() == null) if (defender == null || defender.getPlayer() == null)
{
return true; return true;
}
Location defenderLoc = defender.getPlayer().getLocation(); Location defenderLoc = defender.getPlayer().getLocation();
if (Conf.worldsIgnorePvP.contains(defenderLoc.getWorld().getName())) if (Conf.worldsIgnorePvP.contains(defenderLoc.getWorld().getName()))
{
return true; return true;
}
Faction defLocFaction = Board.getFactionAt(new FLocation(defenderLoc)); Faction defLocFaction = Board.getFactionAt(new FLocation(defenderLoc));
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source // for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
if (damager instanceof Projectile) if (damager instanceof Projectile)
{
damager = ((Projectile)damager).getShooter(); damager = ((Projectile)damager).getShooter();
}
if (damager == damagee) // ender pearl usage and other self-inflicted damage
return true;
// Players can not take attack damage in a SafeZone, or possibly peaceful territory // Players can not take attack damage in a SafeZone, or possibly peaceful territory
@ -196,16 +193,12 @@ public class FactionsEntityListener extends EntityListener
} }
if ( ! (damager instanceof Player)) if ( ! (damager instanceof Player))
{
return true; return true;
}
FPlayer attacker = FPlayers.i.get((Player)damager); FPlayer attacker = FPlayers.i.get((Player)damager);
if (attacker == null || attacker.getPlayer() == null) if (attacker == null || attacker.getPlayer() == null)
{
return true; return true;
}
if (attacker.hasLoginPvpDisabled()) if (attacker.hasLoginPvpDisabled())
{ {