From 5adcf526abc83be8658adea02c4140b1edf401a2 Mon Sep 17 00:00:00 2001 From: sunkid Date: Tue, 27 Dec 2011 10:31:00 -0800 Subject: [PATCH] moved firing of ProjectileHitEvent for mojang projectiles --- src/main/java/net/minecraft/server/EntityEgg.java | 3 --- .../java/net/minecraft/server/EntityProjectile.java | 11 +++++++++++ .../java/net/minecraft/server/EntitySnowball.java | 3 --- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 9b02315680..8d70b30445 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -27,9 +27,6 @@ public class EntityEgg extends EntityProjectile { protected void a(MovingObjectPosition movingobjectposition) { // CraftBukkit start - ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity()); - this.world.getServer().getPluginManager().callEvent(phe); - if (movingobjectposition.entity != null) { boolean stick; if (movingobjectposition.entity instanceof EntityLiving) { diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java index c33e29a347..a0838515e8 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -1,6 +1,11 @@ package net.minecraft.server; import java.util.List; +// CraftBukkit start +import org.bukkit.Bukkit; +import org.bukkit.entity.Projectile; +import org.bukkit.event.entity.ProjectileHitEvent; +// CraftBukkit end public abstract class EntityProjectile extends Entity { @@ -149,6 +154,12 @@ public abstract class EntityProjectile extends Entity { if (movingobjectposition != null) { this.a(movingobjectposition); + // CraftBukkit start + if (this.dead) { + ProjectileHitEvent hitEvent = new ProjectileHitEvent((Projectile) this.getBukkitEntity()); + Bukkit.getPluginManager().callEvent(hitEvent); + } + // CraftBukkit end } this.locX += this.motX; diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java index bbacb28fea..4afb3f79e3 100644 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -6,7 +6,6 @@ import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.entity.Projectile; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit end public class EntitySnowball extends EntityProjectile { @@ -31,8 +30,6 @@ public class EntitySnowball extends EntityProjectile { b0 = 3; } // CraftBukkit start - ProjectileHitEvent hitEvent = new ProjectileHitEvent((Projectile) this.getBukkitEntity()); - Bukkit.getPluginManager().callEvent(hitEvent); final Entity movingEntity = movingobjectposition.entity; boolean stick = false;