From ec17d07def5cca94eb17a8a6dc7f764b03bb2701 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Mon, 4 Mar 2019 16:12:52 +0100 Subject: [PATCH] Use getBukkitEntity for ExplosionPrimeEvent instead of creating new one --- nms-patches/EntityLargeFireball.patch | 2 +- nms-patches/EntityTNTPrimed.patch | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/nms-patches/EntityLargeFireball.patch b/nms-patches/EntityLargeFireball.patch index d3072c01e9..78ddeaa072 100644 --- a/nms-patches/EntityLargeFireball.patch +++ b/nms-patches/EntityLargeFireball.patch @@ -26,7 +26,7 @@ - this.world.createExplosion((Entity) null, this.locX, this.locY, this.locZ, (float) this.yield, flag, flag); + // CraftBukkit start - fire ExplosionPrimeEvent -+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this)); ++ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity()); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { diff --git a/nms-patches/EntityTNTPrimed.patch b/nms-patches/EntityTNTPrimed.patch index d5a2e2c3d2..0b84575023 100644 --- a/nms-patches/EntityTNTPrimed.patch +++ b/nms-patches/EntityTNTPrimed.patch @@ -32,7 +32,7 @@ } else { this.at(); this.world.addParticle(Particles.M, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); -@@ -76,9 +82,17 @@ +@@ -76,9 +82,16 @@ } private void explode() { @@ -41,9 +41,8 @@ + // float f = 4.0F; - this.world.explode(this, this.locX, this.locY + (double) (this.length / 16.0F), this.locZ, 4.0F, true); -+ org.bukkit.craftbukkit.CraftServer server = this.world.getServer(); -+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this)); -+ server.getPluginManager().callEvent(event); ++ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity()); ++ this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 16.0F), this.locZ, event.getRadius(), event.getFire(), true);