70 Zeilen
2.5 KiB
Diff
70 Zeilen
2.5 KiB
Diff
--- a/net/minecraft/server/EntityFireworks.java
|
|
+++ b/net/minecraft/server/EntityFireworks.java
|
|
@@ -3,6 +3,7 @@
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.OptionalInt;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
public class EntityFireworks extends Entity implements IProjectile {
|
|
|
|
@@ -130,7 +131,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
|
|
}
|
|
|
|
}
|
|
@@ -143,7 +148,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.w) {
|
|
BlockPosition blockposition;
|
|
|
|
@@ -155,7 +164,11 @@
|
|
|
|
this.world.getType(blockposition).a(this.world, blockposition, (Entity) this);
|
|
if (this.hasExplosions()) {
|
|
- this.explode();
|
|
+ // CraftBukkit start
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
|
+ this.explode();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|
|
@@ -181,7 +194,9 @@
|
|
|
|
if (f > 0.0F) {
|
|
if (this.ridingEntity != null) {
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
|
this.ridingEntity.damageEntity(DamageSource.FIREWORKS, 5.0F + (float) (nbttaglist.size() * 2));
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
}
|
|
|
|
double d0 = 5.0D;
|
|
@@ -208,7 +223,9 @@
|
|
if (flag) {
|
|
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);
|
|
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
|
entityliving.damageEntity(DamageSource.FIREWORKS, f1);
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
}
|
|
}
|
|
}
|