diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java index 7e3cf5bab2..046f5755f3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java @@ -1,11 +1,8 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.DamageSource; import net.minecraft.server.EntityComplex; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.ComplexLivingEntity; -import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.LivingEntity; public abstract class CraftComplexLivingEntity extends CraftLivingEntity implements ComplexLivingEntity { public CraftComplexLivingEntity(CraftServer server, EntityComplex entity) { @@ -21,21 +18,4 @@ public abstract class CraftComplexLivingEntity extends CraftLivingEntity impleme public String toString() { return "CraftComplexLivingEntity"; } - - @Override - public void damage(int amount, org.bukkit.entity.Entity source) { - DamageSource reason = DamageSource.GENERIC; - - if (source instanceof HumanEntity) { - reason = DamageSource.playerAttack(((CraftHumanEntity) source).getHandle()); - } else if (source instanceof LivingEntity) { - reason = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle()); - } - - if (entity instanceof EntityComplex) { - ((EntityComplex) entity).dealDamage(reason, amount); - } else { - entity.damageEntity(reason, amount); - } - } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index b9a2cd7d6f..e500b230d5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -8,6 +8,7 @@ import java.util.List; import net.minecraft.server.DamageSource; import net.minecraft.server.EntityArrow; +import net.minecraft.server.EntityComplex; import net.minecraft.server.EntityEgg; import net.minecraft.server.EntityEnderPearl; import net.minecraft.server.EntityFireball; @@ -147,7 +148,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public void damage(int amount) { - entity.damageEntity(DamageSource.GENERIC, amount); + damage(amount, null); } public void damage(int amount, org.bukkit.entity.Entity source) { @@ -159,7 +160,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { reason = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle()); } - entity.damageEntity(reason, amount); + if (entity instanceof EntityComplex) { + ((EntityComplex) entity).dealDamage(reason, amount); + } else { + entity.damageEntity(reason, amount); + } } public Location getEyeLocation() {