blob: a0176143cf644611617651d806283537508339f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
@@ -2,6 +2,7 @@
import java.util.Iterator;
import java.util.List;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityFireworks extends Entity {
@@ -114,8 +115,12 @@
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
- this.world.broadcastEntityEffect(this, (byte) 17);
- this.i();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.world.broadcastEntityEffect(this, (byte) 17);
+ this.i();
+ }
+ // CraftBukkit end
this.die();
}
@@ -133,7 +138,9 @@
if (f > 0.0F) {
if (this.e != null) {
+ CraftEventFactory.entityDamage = this; // CraftBukkit
this.e.damageEntity(DamageSource.FIREWORKS, (float) (5 + nbttaglist.size() * 2));
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
double d0 = 5.0D;
@@ -159,7 +166,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
}
}
}
|