SPIGOT-5265: FireworkExplodeEvent only fired when rockets explode in air

This commit is contained in:
md_5 2019-08-26 18:58:28 +10:00
parent b2bcde89d9
commit 3fc97f086d

View File

@ -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 (f > 0.0F) {
if (this.ridingEntity != null) { if (this.ridingEntity != null) {
@ -38,7 +64,7 @@
} }
double d0 = 5.0D; double d0 = 5.0D;
@@ -211,7 +218,9 @@ @@ -211,7 +226,9 @@
if (flag) { if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D); float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);