SPIGOT-4571: EntityCombustEvent not firing for phantoms

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-01-09 20:38:37 +11:00
parent 5a915978fa
commit ab7419bd7d
5 changed files with 75 additions and 125 deletions

View File

@@ -1,11 +1,6 @@
--- a/net/minecraft/server/ItemBow.java
+++ b/net/minecraft/server/ItemBow.java
@@ -1,15 +1,21 @@
package net.minecraft.server;
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
+
public class ItemBow extends Item {
@@ -4,12 +4,16 @@
public ItemBow(Item.Info item_info) {
super(item_info);
@@ -22,33 +17,25 @@
}
private ItemStack a(EntityHuman entityhuman) {
@@ -73,7 +79,20 @@
}
@@ -75,13 +79,29 @@
if (EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_FIRE, itemstack) > 0) {
- entityarrow.setOnFire(100);
+ // CraftBukkit start - call EntityCombustEvent
+ EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
+ entityarrow.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entityarrow.setOnFire(event.getDuration());
+ }
+ // CraftBukkit end
+ }
entityarrow.setOnFire(100);
}
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f);
+ if (event.isCancelled()) {
+ event.getProjectile().remove();
+ return;
}
+ }
+ // CraftBukkit end
itemstack.damage(1, entityhuman);
@@ -81,7 +100,15 @@
if (flag1 || entityhuman.abilities.canInstantlyBuild && (itemstack1.getItem() == Items.SPECTRAL_ARROW || itemstack1.getItem() == Items.TIPPED_ARROW)) {
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
- world.addEntity(entityarrow);
+ // CraftBukkit start
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
+ if (!world.addEntity(entityarrow)) {
+ if (entityhuman instanceof EntityPlayer) {