diff options
author | feildmaster <admin@feildmaster.com> | 2012-07-01 05:00:48 -0500 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2012-07-02 22:22:03 -0500 |
commit | 0a0d5ebf20f170d32da5d63df71a387c82fc7526 (patch) | |
tree | 92a8d42fb396966973f1b298610adc40356e668d /src/main/java | |
parent | ff09ff07f9db2c298a718d34a9d2d0b268a093a6 (diff) | |
download | craftbukkit-0a0d5ebf20f170d32da5d63df71a387c82fc7526.tar craftbukkit-0a0d5ebf20f170d32da5d63df71a387c82fc7526.tar.gz craftbukkit-0a0d5ebf20f170d32da5d63df71a387c82fc7526.tar.lz craftbukkit-0a0d5ebf20f170d32da5d63df71a387c82fc7526.tar.xz craftbukkit-0a0d5ebf20f170d32da5d63df71a387c82fc7526.zip |
Clean entity.damage functions. Fixes BUKKIT-1822
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java | 20 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 9 |
2 files changed, 7 insertions, 22 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java index 7e3cf5ba..046f5755 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 b9a2cd7d..e500b230 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() { |