diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 2c0f689ae9..f46c92091b 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -3,9 +3,7 @@ package net.minecraft.server; import java.util.List; // CraftBukkit start -import org.bukkit.entity.Projectile; import org.bukkit.event.entity.EntityCombustByEntityEvent; -import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end @@ -209,11 +207,7 @@ public class EntityArrow extends Entity implements IProjectile { float f3; if (movingobjectposition != null) { - // CraftBukkit start - Projectile projectile = (Projectile) this.getBukkitEntity(); - ProjectileHitEvent phe = new ProjectileHitEvent(projectile); - this.world.getServer().getPluginManager().callEvent(phe); - // CraftBukkit end + org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event if (movingobjectposition.entity != null) { f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ); diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index 84da8cbac8..194a58fce4 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -2,8 +2,6 @@ package net.minecraft.server; import java.util.List; -import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit - public abstract class EntityFireball extends Entity { private int e = -1; @@ -133,8 +131,7 @@ public abstract class EntityFireball extends Entity { // CraftBukkit start if (this.dead) { - ProjectileHitEvent phe = new ProjectileHitEvent((org.bukkit.entity.Projectile) this.getBukkitEntity()); - this.world.getServer().getPluginManager().callEvent(phe); + org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); } // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java index b35a5d6588..a3bb5d0d72 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -178,6 +178,7 @@ public class EntityFishingHook extends Entity { } if (movingobjectposition != null) { + org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event if (movingobjectposition.entity != null) { if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0)) { this.hooked = movingobjectposition.entity; diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java index 85ca93d3f3..2ab11b3c3c 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -2,8 +2,6 @@ package net.minecraft.server; import java.util.List; -import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit - public abstract class EntityProjectile extends Entity implements IProjectile { private int blockX = -1; @@ -158,8 +156,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile { this.a(movingobjectposition); // CraftBukkit start if (this.dead) { - ProjectileHitEvent hitEvent = new ProjectileHitEvent((org.bukkit.entity.Projectile) this.getBukkitEntity()); - org.bukkit.Bukkit.getPluginManager().callEvent(hitEvent); + org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); } // CraftBukkit end } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 349423271a..f65b7f8598 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -532,6 +532,12 @@ public class CraftEventFactory { return event; } + public static ProjectileHitEvent callProjectileHitEvent(Entity entity) { + ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity()); + entity.world.getServer().getPluginManager().callEvent(event); + return event; + } + public static ExpBottleEvent callExpBottleEvent(Entity entity, int exp) { ThrownExpBottle bottle = (ThrownExpBottle) entity.getBukkitEntity(); ExpBottleEvent event = new ExpBottleEvent(bottle, exp);