From 1c07d5c78f07bf8a5dcc73c6f16f1b9743565b06 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 28 Nov 2016 12:47:01 +1100 Subject: Add hitEntity to ProjectileHitEvent --- nms-patches/EntityArrow.patch | 2 +- nms-patches/EntityFireball.patch | 2 +- nms-patches/EntityFishingHook.patch | 2 +- nms-patches/EntityProjectile.patch | 2 +- src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch index f8c15319..656ebe0a 100644 --- a/nms-patches/EntityArrow.patch +++ b/nms-patches/EntityArrow.patch @@ -27,7 +27,7 @@ protected void a(MovingObjectPosition movingobjectposition) { Entity entity = movingobjectposition.entity; - -+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event ++ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event if (entity != null) { float f = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ); int i = MathHelper.f((double) f * this.damage); diff --git a/nms-patches/EntityFireball.patch b/nms-patches/EntityFireball.patch index 02e43ed8..28389160 100644 --- a/nms-patches/EntityFireball.patch +++ b/nms-patches/EntityFireball.patch @@ -44,7 +44,7 @@ + + // CraftBukkit start - Fire ProjectileHitEvent + if (this.dead) { -+ CraftEventFactory.callProjectileHitEvent(this); ++ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); + } + // CraftBukkit end } diff --git a/nms-patches/EntityFishingHook.patch b/nms-patches/EntityFishingHook.patch index 8aea9439..7b0fbc62 100644 --- a/nms-patches/EntityFishingHook.patch +++ b/nms-patches/EntityFishingHook.patch @@ -16,7 +16,7 @@ } if (movingobjectposition != null && movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.MISS) { -+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event ++ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // Craftbukkit - Call event if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.ENTITY) { this.hooked = movingobjectposition.entity; this.s(); diff --git a/nms-patches/EntityProjectile.patch b/nms-patches/EntityProjectile.patch index 5e01a87c..17b70ac1 100644 --- a/nms-patches/EntityProjectile.patch +++ b/nms-patches/EntityProjectile.patch @@ -14,7 +14,7 @@ this.a(movingobjectposition); + // CraftBukkit start + if (this.dead) { -+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); ++ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); + } + // 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 3d3ea631..2621b777 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -778,8 +778,8 @@ public class CraftEventFactory { return event; } - public static ProjectileHitEvent callProjectileHitEvent(Entity entity) { - ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity()); + public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) { + ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entity == null ? null : position.entity.getBukkitEntity()); entity.world.getServer().getPluginManager().callEvent(event); return event; } -- cgit v1.2.3