summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityMonster.patch
blob: 0a19ca7d49f3ab7264dc140b2f89918f9ecce694 (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
--- a/net/minecraft/server/EntityMonster.java
+++ b/net/minecraft/server/EntityMonster.java
@@ -1,5 +1,7 @@
 package net.minecraft.server;
 
+import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
+
 public abstract class EntityMonster extends EntityCreature implements IMonster {
 
     public EntityMonster(World world) {
@@ -75,7 +77,14 @@
             int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);
 
             if (j > 0) {
-                entity.setOnFire(j * 4);
+                // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+                EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
+                org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+                if (!combustEvent.isCancelled()) {
+                    entity.setOnFire(combustEvent.getDuration());
+                }
+                // CraftBukkit end
             }
 
             if (entity instanceof EntityHuman) {