summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntitySkeleton.patch
blob: 17b86073a567940c154c12a0f2958c7904510df7 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--- ../work/decompile-8eb82bde//net/minecraft/server/EntitySkeleton.java	2014-11-28 17:43:43.157707434 +0000
+++ src/main/java/net/minecraft/server/EntitySkeleton.java	2014-11-28 17:38:18.000000000 +0000
@@ -2,6 +2,8 @@
 
 import java.util.Calendar;
 
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
+
 public class EntitySkeleton extends EntityMonster implements IRangedEntity {
 
     private PathfinderGoalArrowAttack b = new PathfinderGoalArrowAttack(this, 1.0D, 20, 60, 15.0F);
@@ -90,7 +92,14 @@
                 }
 
                 if (flag) {
-                    this.setOnFire(8);
+                    // CraftBukkit start
+                    EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
+                    this.world.getServer().getPluginManager().callEvent(event);
+
+                    if (!event.isCancelled()) {
+                        this.setOnFire(event.getDuration());
+                    }
+                    // CraftBukkit end
                 }
             }
         }
@@ -225,11 +234,30 @@
         }
 
         if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bz()) > 0 || this.getSkeletonType() == 1) {
-            entityarrow.setOnFire(100);
+            // CraftBukkit start - call EntityCombustEvent
+            EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
+            this.world.getServer().getPluginManager().callEvent(event);
+
+            if (!event.isCancelled()) {
+                entityarrow.setOnFire(event.getDuration());
+            }
+            // CraftBukkit end
+        }
+
+        // CraftBukkit start
+        org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.bz(), entityarrow, 0.8F);
+        if (event.isCancelled()) {
+            event.getProjectile().remove();
+            return;
+        }
+
+        if (event.getProjectile() == entityarrow.getBukkitEntity()) {
+            world.addEntity(entityarrow);
         }
+        // CraftBukkit end
 
         this.makeSound("random.bow", 1.0F, 1.0F / (this.bb().nextFloat() * 0.4F + 0.8F));
-        this.world.addEntity(entityarrow);
+        // this.world.addEntity(entityarrow); // CraftBukkit - moved up
     }
 
     public int getSkeletonType() {