Fixed AE abilities not being applied correctly

This commit is contained in:
bm01 2012-06-22 23:10:17 +02:00
parent e61342177d
commit 6b84d39dda

View File

@ -345,7 +345,7 @@ public class Combat {
break; break;
} }
if (!shouldBeAffected(attacker, target)) { if (!shouldBeAffected(attacker, entity)) {
continue; continue;
} }
@ -485,17 +485,17 @@ public class Combat {
* *
* @param player The attacking Player * @param player The attacking Player
* @param livingEntity The defending LivingEntity * @param livingEntity The defending LivingEntity
* @return true if the LivingEntity should be damaged, false otherwise. * @return true if the Entity should be damaged, false otherwise.
*/ */
public static boolean shouldBeAffected(Player player, LivingEntity livingEntity) { public static boolean shouldBeAffected(Player player, Entity entity) {
if (livingEntity instanceof Player) { if (entity instanceof Player) {
Player defender = (Player) livingEntity; Player defender = (Player) entity;
if (!defender.getWorld().getPVP()) { if (!defender.getWorld().getPVP()) {
return false; return false;
} }
if (defender.getName().equals(player.getName())) { if (defender == player) {
return false; return false;
} }
@ -507,8 +507,8 @@ public class Combat {
return false; return false;
} }
} }
else if (livingEntity instanceof Tameable) { else if (entity instanceof Tameable) {
Tameable pet = (Tameable) livingEntity; Tameable pet = (Tameable) entity;
if (pet.isTamed()) { if (pet.isTamed()) {
AnimalTamer tamer = pet.getOwner(); AnimalTamer tamer = pet.getOwner();