Paper/nms-patches/EntityMonster.patch

27 lines
1.1 KiB
Diff
Raw Normal View History

2015-05-25 18:37:24 +08:00
--- 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 {
2015-02-27 06:41:06 +08:00
public EntityMonster(World world) {
2016-11-17 09:41:03 +08:00
@@ -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
}
2016-03-01 05:32:46 +08:00
if (entity instanceof EntityHuman) {