From 3fc97f086dbea5c6ee9a16e80ee7dc7f19aa7c75 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 26 Aug 2019 18:58:28 +1000 Subject: [PATCH] SPIGOT-5265: FireworkExplodeEvent only fired when rockets explode in air --- nms-patches/EntityFireworks.patch | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/nms-patches/EntityFireworks.patch b/nms-patches/EntityFireworks.patch index ae3b56acf6..89b3bd1e13 100644 --- a/nms-patches/EntityFireworks.patch +++ b/nms-patches/EntityFireworks.patch @@ -28,7 +28,33 @@ } } -@@ -184,7 +189,9 @@ +@@ -146,7 +151,11 @@ + + protected void a(MovingObjectPosition movingobjectposition) { + if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY && !this.world.isClientSide) { +- this.explode(); ++ // CraftBukkit start ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) { ++ this.explode(); ++ } ++ // CraftBukkit end + } else if (this.z) { + BlockPosition blockposition; + +@@ -158,7 +167,11 @@ + + this.world.getType(blockposition).a(this.world, blockposition, (Entity) this); + if (this.l()) { +- this.explode(); ++ // CraftBukkit start ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) { ++ this.explode(); ++ } ++ // CraftBukkit end + } + } + +@@ -184,7 +197,9 @@ if (f > 0.0F) { if (this.ridingEntity != null) { @@ -38,7 +64,7 @@ } double d0 = 5.0D; -@@ -211,7 +218,9 @@ +@@ -211,7 +226,9 @@ if (flag) { float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);