diff options
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockCactus.java | 14 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/Entity.java | 3 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java index 2f0aa35f..1d288217 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -9,6 +9,7 @@ import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; // CraftBukkit end import java.util.Random; @@ -100,16 +101,21 @@ public class BlockCactus extends Block { if(entity instanceof EntityLiving) { CraftServer server = ((WorldServer) world).getServer(); - CraftEntity toPassIn = new CraftLivingEntity(server, (EntityLiving) entity); - EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamageEvent.DamageCause.CONTACT, 1); + org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k); + org.bukkit.entity.Entity damagee = entity.getBukkitEntity(); + DamageCause damageType = EntityDamageEvent.DamageCause.CONTACT; + int damageDone = 1; + + EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone); server.getPluginManager().callEvent(edbbe); if (!edbbe.isCancelled()){ entity.a(((Entity) (null)), edbbe.getDamage()); } return; + } else { + entity.a(((Entity) (null)), 1); } - // CraftBukkit end - entity.a(((Entity) (null)), 1); + // CraftBukkit end } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index d56f1de9..69c619dc 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -256,11 +256,12 @@ public abstract class Entity { // CraftBukkit start if(this instanceof EntityLiving) { CraftServer server = ((WorldServer) l).getServer(); + org.bukkit.block.Block damager = null;//((WorldServer) l).getWorld().getBlockAt(i, j, k); org.bukkit.entity.Entity damagee = this.getBukkitEntity(); DamageCause damageType = EntityDamageEvent.DamageCause.LAVA; int damageDone = 4; - EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone); + EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone); server.getPluginManager().callEvent(ede); if (!ede.isCancelled()){ a(((Entity) (null)), ede.getDamage()); |