From de6cdd0364ef302c36e36047b6091f1f9d55a647 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 25 Apr 2019 09:23:21 +1000 Subject: [PATCH] SPIGOT-4735: ProjectileHitEvent Fires Immediately --- .../org/bukkit/craftbukkit/event/CraftEventFactory.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 32efe87d87..3eb6a23e3c 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1052,7 +1052,11 @@ public class CraftEventFactory { return event; } - public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) { + public static void callProjectileHitEvent(Entity entity, MovingObjectPosition position) { + if (position.getType() == MovingObjectPosition.EnumMovingObjectType.MISS) { + return; + } + Block hitBlock = null; BlockFace hitFace = null; if (position.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) { @@ -1068,7 +1072,6 @@ public class CraftEventFactory { ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), hitEntity, hitBlock, hitFace); entity.world.getServer().getPluginManager().callEvent(event); - return event; } public static ExpBottleEvent callExpBottleEvent(Entity entity, int exp) {