SPIGOT-5830: Server crash when campfire lit via dispenser.

Also adds a missing call to BlockIgniteEvent for players igniting campfires with flint and steel.

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2020-06-25 19:01:18 -04:00
parent 61ff27fa00
commit 6ccde4e6fd
3 changed files with 19 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ import net.minecraft.server.GeneratorAccess;
import net.minecraft.server.IBlockData;
import net.minecraft.server.IChatBaseComponent;
import net.minecraft.server.IInventory;
import net.minecraft.server.IProjectile;
import net.minecraft.server.ItemActionContext;
import net.minecraft.server.ItemStack;
import net.minecraft.server.Items;
@@ -208,6 +209,7 @@ import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.projectiles.ProjectileSource;
public class CraftEventFactory {
public static final DamageSource MELTING = CraftDamageSource.copyOf(DamageSource.BURN);
@@ -1213,6 +1215,13 @@ public class CraftEventFactory {
cause = IgniteCause.FLINT_AND_STEEL;
}
if (igniter instanceof IProjectile) {
Entity shooter = ((IProjectile) igniter).getShooter();
if (shooter != null) {
bukkitIgniter = shooter.getBukkitEntity();
}
}
BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), cause, bukkitIgniter);
world.getServer().getPluginManager().callEvent(event);
return event;