Paper/nms-patches/EntityFireworks.patch
2020-06-25 10:00:00 +10:00

70 Zeilen
2.5 KiB
Diff

--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
@@ -4,6 +4,7 @@
import java.util.List;
import java.util.OptionalInt;
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityFireworks extends IProjectile {
@@ -119,7 +120,11 @@
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
- this.explode();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.explode();
+ }
+ // CraftBukkit end
}
}
@@ -134,7 +139,11 @@
protected void a(MovingObjectPositionEntity movingobjectpositionentity) {
super.a(movingobjectpositionentity);
if (!this.world.isClientSide) {
- this.explode();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.explode();
+ }
+ // CraftBukkit end
}
}
@@ -144,7 +153,11 @@
this.world.getType(blockposition).a(this.world, blockposition, (Entity) this);
if (!this.world.s_() && this.hasExplosions()) {
- this.explode();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.explode();
+ }
+ // CraftBukkit end
}
super.a(movingobjectpositionblock);
@@ -170,7 +183,9 @@
if (f > 0.0F) {
if (this.ridingEntity != null) {
+ CraftEventFactory.entityDamage = this; // CraftBukkit
this.ridingEntity.damageEntity(DamageSource.a(this, this.getShooter()), 5.0F + (float) (nbttaglist.size() * 2));
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
double d0 = 5.0D;
@@ -197,7 +212,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);
+ CraftEventFactory.entityDamage = this; // CraftBukkit
entityliving.damageEntity(DamageSource.a(this, this.getShooter()), f1);
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
}
}