From 42233f1f72923f107ce616e200946379aadfcae5 Mon Sep 17 00:00:00 2001 From: Intelli Date: Fri, 25 Feb 2022 16:14:35 -0700 Subject: [PATCH] Fixed phantom fire blocks being logged adjacent to lava --- .../listener/block/BlockIgniteListener.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/main/java/net/coreprotect/listener/block/BlockIgniteListener.java b/src/main/java/net/coreprotect/listener/block/BlockIgniteListener.java index 8e5c17a..a1e483d 100644 --- a/src/main/java/net/coreprotect/listener/block/BlockIgniteListener.java +++ b/src/main/java/net/coreprotect/listener/block/BlockIgniteListener.java @@ -4,6 +4,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Lightable; @@ -77,6 +78,52 @@ public final class BlockIgniteListener extends ProjectileLaunchListener implemen } } + if (blockIgnited == Material.FIRE && event.getCause() == IgniteCause.LAVA && event.getIgnitingBlock() != null) { + boolean burnableBlock = false; + for (BlockFace face : BlockFace.values()) { + Location blockLocation = block.getLocation(); + scanLocation.setX(blockLocation.getX()); + scanLocation.setY(blockLocation.getY()); + scanLocation.setZ(blockLocation.getZ()); + + switch (face) { + case NORTH: + scanLocation.setZ(scanLocation.getZ() - 1); + break; + case SOUTH: + scanLocation.setZ(scanLocation.getZ() + 1); + break; + case WEST: + scanLocation.setX(scanLocation.getX() - 1); + break; + case EAST: + scanLocation.setX(scanLocation.getX() + 1); + break; + case DOWN: + scanLocation.setY(scanLocation.getY() - 1); + break; + case UP: + scanLocation.setY(scanLocation.getY() + 1); + break; + default: + continue; + } + + if (scanLocation.getY() < BukkitAdapter.ADAPTER.getMinHeight(world) || scanLocation.getY() >= world.getMaxHeight()) { + continue; + } + + if (scanLocation.getBlock().getType().isBurnable()) { + burnableBlock = true; + break; + } + } + + if (!burnableBlock) { + return; + } + } + Queue.queueBlockPlace("#fire", block.getState(), block.getType(), replacedBlock, blockIgnited, -1, 0, forceBlockData.getAsString()); } else {