From e4ee6f944da49a558b868b60addbb31194e5a7df Mon Sep 17 00:00:00 2001 From: Dark Arc Date: Tue, 8 Jan 2013 14:39:28 +1100 Subject: [PATCH] [Experimental] Major improvements to LogBlock's accuracy. --- pom.xml | 2 +- .../LogBlock/listeners/BlockBreakLogging.java | 55 ++++--- .../LogBlock/listeners/BlockBurnLogging.java | 8 +- .../LogBlock/listeners/BlockPlaceLogging.java | 27 +++- .../listeners/LeavesDecayLogging.java | 8 +- src/main/java/de/diddiz/util/BukkitUtils.java | 140 ++++++++++++----- src/main/java/de/diddiz/util/LoggingUtil.java | 148 ++++++++++++++++++ 7 files changed, 307 insertions(+), 81 deletions(-) create mode 100644 src/main/java/de/diddiz/util/LoggingUtil.java diff --git a/pom.xml b/pom.xml index 71f7700..ec3ec67 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ org.bukkit bukkit - 1.4.5-R0.3-SNAPSHOT + 1.4.6-R0.3 ${project.groupId} diff --git a/src/main/java/de/diddiz/LogBlock/listeners/BlockBreakLogging.java b/src/main/java/de/diddiz/LogBlock/listeners/BlockBreakLogging.java index a5978e5..da4e1ae 100644 --- a/src/main/java/de/diddiz/LogBlock/listeners/BlockBreakLogging.java +++ b/src/main/java/de/diddiz/LogBlock/listeners/BlockBreakLogging.java @@ -2,9 +2,11 @@ package de.diddiz.LogBlock.listeners; import static de.diddiz.LogBlock.config.Config.getWorldConfig; import static de.diddiz.LogBlock.config.Config.isLogging; -import java.util.List; -import org.bukkit.Location; -import org.bukkit.block.BlockFace; +import static de.diddiz.util.LoggingUtil.smartLogBlockBreak; +import static de.diddiz.util.LoggingUtil.smartLogFallables; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.block.Sign; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -23,39 +25,36 @@ public class BlockBreakLogging extends LoggingListener @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { - final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld()); - if (wcfg != null && wcfg.isLogging(Logging.BLOCKBREAK)) { - final int type = event.getBlock().getTypeId(); + if (isLogging(event.getBlock().getWorld(), Logging.BLOCKBREAK)) { + WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld()); + if (wcfg == null) return; + + final String playerName = event.getPlayer().getName(); + final Block origin = event.getBlock(); + final int type = origin.getTypeId(); + if (wcfg.isLogging(Logging.SIGNTEXT) && (type == 63 || type == 68)) { - consumer.queueSignBreak(event.getPlayer().getName(), (Sign)event.getBlock().getState()); - } - else if (wcfg.isLogging(Logging.CHESTACCESS) && (type == 23 || type == 54 || type == 61)) { - consumer.queueContainerBreak(event.getPlayer().getName(), event.getBlock().getState()); - } - else if (type == 79) { - consumer.queueBlockReplace(event.getPlayer().getName(), event.getBlock().getState(), 9, (byte)0); - } - else { - consumer.queueBlockBreak(event.getPlayer().getName(), event.getBlock().getState()); - if (BukkitUtils.getRelativeTopBreakabls().contains(event.getBlock().getRelative(BlockFace.UP).getTypeId())) { - consumer.queueBlockBreak(event.getPlayer().getName(), event.getBlock().getRelative(BlockFace.UP).getState()); - } - List nearbySigns = BukkitUtils.getBlocksNearby(event.getBlock(), BukkitUtils.getRelativeBreakables()); - if(nearbySigns.size() != 0) { - for(Location location : nearbySigns) { - int blockType = location.getBlock().getTypeId(); - if (wcfg.isLogging(Logging.SIGNTEXT) && (blockType == 63 || type == 68)) - consumer.queueSignBreak(event.getPlayer().getName(), (Sign) location.getBlock().getState()); - consumer.queueBlockBreak(event.getPlayer().getName(), location.getBlock().getState()); - } + consumer.queueSignBreak(playerName, (Sign) origin.getState()); + } else if (wcfg.isLogging(Logging.CHESTACCESS) && (type == 23 || type == 54 || type == 61)) { + consumer.queueContainerBreak(playerName, origin.getState()); + } else if (origin.getType() == Material.ICE) { + // When in creative mode ice doesn't form water + if (event.getPlayer().getGameMode().equals(GameMode.CREATIVE)) { + consumer.queueBlockBreak(playerName, origin.getState()); + } else { + consumer.queueBlockReplace(playerName, origin.getState(), 9, (byte) 0); } + } else { + smartLogBlockBreak(consumer, playerName, origin); } + smartLogFallables(consumer, playerName, origin); } } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerBucketFill(PlayerBucketFillEvent event) { - if (isLogging(event.getPlayer().getWorld(), Logging.BLOCKBREAK)) + if (isLogging(event.getBlockClicked().getWorld(), Logging.BLOCKBREAK)) { consumer.queueBlockBreak(event.getPlayer().getName(), event.getBlockClicked().getState()); + } } } diff --git a/src/main/java/de/diddiz/LogBlock/listeners/BlockBurnLogging.java b/src/main/java/de/diddiz/LogBlock/listeners/BlockBurnLogging.java index 78e6b55..7119ab4 100644 --- a/src/main/java/de/diddiz/LogBlock/listeners/BlockBurnLogging.java +++ b/src/main/java/de/diddiz/LogBlock/listeners/BlockBurnLogging.java @@ -1,6 +1,8 @@ package de.diddiz.LogBlock.listeners; import static de.diddiz.LogBlock.config.Config.isLogging; +import static de.diddiz.util.LoggingUtil.smartLogBlockBreak; +import static de.diddiz.util.LoggingUtil.smartLogFallables; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBurnEvent; @@ -15,7 +17,9 @@ public class BlockBurnLogging extends LoggingListener @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockBurn(BlockBurnEvent event) { - if (isLogging(event.getBlock().getWorld(), Logging.FIRE)) - consumer.queueBlockBreak("Fire", event.getBlock().getState()); + if (isLogging(event.getBlock().getWorld(), Logging.FIRE)) { + smartLogBlockBreak(consumer, "Fire", event.getBlock()); + smartLogFallables(consumer, "Fire", event.getBlock()); + } } } diff --git a/src/main/java/de/diddiz/LogBlock/listeners/BlockPlaceLogging.java b/src/main/java/de/diddiz/LogBlock/listeners/BlockPlaceLogging.java index c6dee5a..23441c5 100644 --- a/src/main/java/de/diddiz/LogBlock/listeners/BlockPlaceLogging.java +++ b/src/main/java/de/diddiz/LogBlock/listeners/BlockPlaceLogging.java @@ -5,6 +5,7 @@ import static de.diddiz.LogBlock.config.Config.isLogging; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -31,21 +32,33 @@ public class BlockPlaceLogging extends LoggingListener final String playerName = event.getPlayer().getName(); //Handle falling blocks - if (event.getBlock().getType() == Material.SAND || event.getBlock().getType() == Material.GRAVEL || event.getBlock().getType() == Material.DRAGON_EGG) { + if (BukkitUtils.getRelativeTopFallables().contains(type)) { + + // Catch placed blocks overwriting something + if (before.getType() != Material.AIR) { + consumer.queueBlockBreak(playerName, before); + } + Location loc = event.getBlock().getLocation(); int x = loc.getBlockX(); int y = loc.getBlockY(); int z = loc.getBlockZ(); - while (y > 0 && BukkitUtils.canFall(loc.getWorld(), x, (y - 1), z)) { - y--; + // Blocks only fall if they have a chance to start a velocity + if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR) { + while (y > 0 && BukkitUtils.canFall(loc.getWorld(), x, (y - 1), z)) { + y--; + } } // If y is 0 then the sand block fell out of the world :( if (y != 0) { Location finalLoc = new Location(loc.getWorld(), x, y, z); - if (finalLoc.getBlock().getType() == Material.AIR) { - consumer.queueBlockPlace(playerName, finalLoc, type, event.getBlock().getData()); - } else { - consumer.queueBlockReplace(playerName, finalLoc, finalLoc.getBlock().getTypeId(), finalLoc.getBlock().getData(), type, event.getBlock().getData()); + // Run this check to avoid false positives + if (!BukkitUtils.getFallingEntityKillers().contains(finalLoc.getBlock().getTypeId())) { + if (finalLoc.getBlock().getType() == Material.AIR || finalLoc.equals(event.getBlock().getLocation())) { + consumer.queueBlockPlace(playerName, finalLoc, type, event.getBlock().getData()); + } else { + consumer.queueBlockReplace(playerName, finalLoc, finalLoc.getBlock().getTypeId(), finalLoc.getBlock().getData(), type, event.getBlock().getData()); + } } } return; diff --git a/src/main/java/de/diddiz/LogBlock/listeners/LeavesDecayLogging.java b/src/main/java/de/diddiz/LogBlock/listeners/LeavesDecayLogging.java index ee0c4bc..204749d 100644 --- a/src/main/java/de/diddiz/LogBlock/listeners/LeavesDecayLogging.java +++ b/src/main/java/de/diddiz/LogBlock/listeners/LeavesDecayLogging.java @@ -1,6 +1,8 @@ package de.diddiz.LogBlock.listeners; import static de.diddiz.LogBlock.config.Config.isLogging; +import static de.diddiz.util.LoggingUtil.smartLogBlockBreak; +import static de.diddiz.util.LoggingUtil.smartLogFallables; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.LeavesDecayEvent; @@ -15,7 +17,9 @@ public class LeavesDecayLogging extends LoggingListener @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onLeavesDecay(LeavesDecayEvent event) { - if (isLogging(event.getBlock().getWorld(), Logging.LEAVESDECAY)) - consumer.queueBlockBreak("LeavesDecay", event.getBlock().getState()); + if (isLogging(event.getBlock().getWorld(), Logging.LEAVESDECAY)) { + smartLogBlockBreak(consumer, "LeavesDecay", event.getBlock()); + smartLogFallables(consumer, "LeavesDecay", event.getBlock()); + } } } diff --git a/src/main/java/de/diddiz/util/BukkitUtils.java b/src/main/java/de/diddiz/util/BukkitUtils.java index 14a5b8d..097f3be 100644 --- a/src/main/java/de/diddiz/util/BukkitUtils.java +++ b/src/main/java/de/diddiz/util/BukkitUtils.java @@ -27,8 +27,10 @@ import org.bukkit.inventory.ItemStack; public class BukkitUtils { private static final Set> blockEquivalents; - private static final Set relativeBreakable; - private static final Set relativeTopBreakable; + private static final Set relativeBreakable; + private static final Set relativeTopBreakable; + private static final Set relativeTopFallables; + private static final Set fallingEntityKillers; static { blockEquivalents = new HashSet>(7); @@ -40,34 +42,87 @@ public class BukkitUtils blockEquivalents.add(new HashSet(Arrays.asList(75, 76))); blockEquivalents.add(new HashSet(Arrays.asList(93, 94))); - relativeBreakable = new HashSet(2); - relativeBreakable.add(63); // Sign - relativeBreakable.add(68); // Sign - relativeBreakable.add(65); // Ladder - relativeBreakable.add(77); // Button + // Blocks that break when they are attached to a block + relativeBreakable = new HashSet(11); + relativeBreakable.add(Material.WALL_SIGN); + relativeBreakable.add(Material.LADDER); + relativeBreakable.add(Material.STONE_BUTTON); + relativeBreakable.add(Material.WOOD_BUTTON); + relativeBreakable.add(Material.REDSTONE_TORCH_ON); + relativeBreakable.add(Material.REDSTONE_TORCH_OFF); + relativeBreakable.add(Material.LEVER); + relativeBreakable.add(Material.TORCH); + relativeBreakable.add(Material.TRAP_DOOR); + relativeBreakable.add(Material.TRIPWIRE_HOOK); + relativeBreakable.add(Material.COCOA); - relativeTopBreakable = new HashSet(19); - relativeTopBreakable.add(6); ////Vegetation start//// - relativeTopBreakable.add(31); // - relativeTopBreakable.add(32); // - relativeTopBreakable.add(37); // - relativeTopBreakable.add(38); // - relativeTopBreakable.add(39); // - relativeTopBreakable.add(40); // - relativeTopBreakable.add(59); // - relativeTopBreakable.add(81); // - relativeTopBreakable.add(83); ////Vegetation end//// - relativeTopBreakable.add(27); // Powered rail - relativeTopBreakable.add(28); // Detector rail - relativeTopBreakable.add(66); // Rails - relativeTopBreakable.add(55); // Redstone - relativeTopBreakable.add(70); // Stone pressure plate - relativeTopBreakable.add(72); // Wood pressure plate - relativeTopBreakable.add(78); // Snow - relativeTopBreakable.add(93); // Redstone repeater - relativeTopBreakable.add(94); // Redstone repeater + // Blocks that break when they are on top of a block + relativeTopBreakable = new HashSet(26); + relativeTopBreakable.add(Material.SAPLING); + relativeTopBreakable.add(Material.LONG_GRASS); + relativeTopBreakable.add(Material.DEAD_BUSH); + relativeTopBreakable.add(Material.YELLOW_FLOWER); + relativeTopBreakable.add(Material.RED_ROSE); + relativeTopBreakable.add(Material.BROWN_MUSHROOM); + relativeTopBreakable.add(Material.RED_MUSHROOM); + relativeTopBreakable.add(Material.CROPS); + relativeTopBreakable.add(Material.POTATO); + relativeTopBreakable.add(Material.CARROT); + relativeTopBreakable.add(Material.WATER_LILY); + relativeTopBreakable.add(Material.CACTUS); + relativeTopBreakable.add(Material.SUGAR_CANE_BLOCK); + relativeTopBreakable.add(Material.FLOWER_POT); + relativeTopBreakable.add(Material.POWERED_RAIL); + relativeTopBreakable.add(Material.DETECTOR_RAIL); + relativeTopBreakable.add(Material.RAILS); + relativeTopBreakable.add(Material.REDSTONE_WIRE); + relativeTopBreakable.add(Material.SIGN_POST); + relativeTopBreakable.add(Material.STONE_PLATE); + relativeTopBreakable.add(Material.WOOD_PLATE); + relativeTopBreakable.add(Material.SNOW); + relativeTopBreakable.add(Material.DIODE_BLOCK_ON); + relativeTopBreakable.add(Material.DIODE_BLOCK_OFF); + relativeTopBreakable.add(Material.WOODEN_DOOR); + relativeTopBreakable.add(Material.IRON_DOOR); + + // Blocks that fall + relativeTopFallables = new HashSet(4); + relativeTopFallables.add(Material.SAND); + relativeTopFallables.add(Material.GRAVEL); + relativeTopFallables.add(Material.DRAGON_EGG); + relativeTopFallables.add(Material.ANVIL); + + // Blocks that break falling entities + fallingEntityKillers = new HashSet(23); + fallingEntityKillers.add(Material.SIGN_POST); + fallingEntityKillers.add(Material.WALL_SIGN); + fallingEntityKillers.add(Material.SAPLING); + fallingEntityKillers.add(Material.YELLOW_FLOWER); + fallingEntityKillers.add(Material.RED_ROSE); + fallingEntityKillers.add(Material.CROPS); + fallingEntityKillers.add(Material.CARROT); + fallingEntityKillers.add(Material.POTATO); + fallingEntityKillers.add(Material.RED_MUSHROOM); + fallingEntityKillers.add(Material.BROWN_MUSHROOM); + fallingEntityKillers.add(Material.STEP); + fallingEntityKillers.add(Material.WOOD_STEP); + fallingEntityKillers.add(Material.TORCH); + fallingEntityKillers.add(Material.FLOWER_POT); + fallingEntityKillers.add(Material.POWERED_RAIL); + fallingEntityKillers.add(Material.DETECTOR_RAIL); + fallingEntityKillers.add(Material.RAILS); + fallingEntityKillers.add(Material.LEVER); + fallingEntityKillers.add(Material.REDSTONE_WIRE); + fallingEntityKillers.add(Material.REDSTONE_TORCH_ON); + fallingEntityKillers.add(Material.REDSTONE_TORCH_OFF); + fallingEntityKillers.add(Material.DIODE_BLOCK_ON); + fallingEntityKillers.add(Material.DIODE_BLOCK_OFF); } + private static final BlockFace[] relativeBlockFaces = new BlockFace[] { + BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.UP, BlockFace.DOWN + }; + /** * Returns a list of block locations around the block that are of the type specified by the integer list parameter * @@ -75,18 +130,13 @@ public class BukkitUtils * @param type * @return List of block locations around the block that are of the type specified by the integer list parameter */ - public static List getBlocksNearby(org.bukkit.block.Block block, Set type) { + public static List getBlocksNearby(org.bukkit.block.Block block, Set type) { ArrayList blocks = new ArrayList(); - if (type.contains(block.getRelative(BlockFace.EAST).getTypeId())) - blocks.add(block.getRelative(BlockFace.EAST).getLocation()); - if (type.contains(block.getRelative(BlockFace.WEST).getTypeId())) - blocks.add(block.getRelative(BlockFace.WEST).getLocation()); - if (type.contains(block.getRelative(BlockFace.NORTH).getTypeId())) - blocks.add(block.getRelative(BlockFace.NORTH).getLocation()); - if (type.contains(block.getRelative(BlockFace.SOUTH).getTypeId())) - blocks.add(block.getRelative(BlockFace.SOUTH).getLocation()); - if (type.contains(block.getRelative(BlockFace.UP).getTypeId())) - blocks.add(block.getRelative(BlockFace.UP).getLocation()); + for (BlockFace blockFace : relativeBlockFaces) { + if (type.contains(block.getRelative(blockFace).getType())) { + blocks.add(block.getRelative(blockFace).getLocation()); + } + } return blocks; } @@ -185,14 +235,22 @@ public class BukkitUtils return blockEquivalents; } - public static Set getRelativeBreakables() { + public static Set getRelativeBreakables() { return relativeBreakable; } - public static Set getRelativeTopBreakabls() { + public static Set getRelativeTopBreakabls() { return relativeTopBreakable; } + public static Set getRelativeTopFallables() { + return relativeTopFallables; + } + + public static Set getFallingEntityKillers() { + return fallingEntityKillers; + } + public static String entityName(Entity entity) { if (entity instanceof Player) return ((Player)entity).getName(); @@ -261,7 +319,7 @@ public class BukkitUtils return true; } else if (mat == Material.WATER || mat == Material.STATIONARY_WATER || mat == Material.LAVA || mat == Material.STATIONARY_LAVA) { // Fluids return true; - } else if (mat == Material.SIGN || mat == Material.FIRE) { // Misc. + } else if (getFallingEntityKillers().contains(mat.getId()) || mat == Material.FIRE || mat == Material.VINE || mat == Material.LONG_GRASS || mat == Material.DEAD_BUSH) { // Misc. return true; } return false; diff --git a/src/main/java/de/diddiz/util/LoggingUtil.java b/src/main/java/de/diddiz/util/LoggingUtil.java new file mode 100644 index 0000000..b7969f1 --- /dev/null +++ b/src/main/java/de/diddiz/util/LoggingUtil.java @@ -0,0 +1,148 @@ +package de.diddiz.util; + +import static de.diddiz.LogBlock.config.Config.getWorldConfig; +import java.util.List; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.block.Sign; +import org.bukkit.material.Button; +import org.bukkit.material.CocoaPlant; +import org.bukkit.material.Ladder; +import org.bukkit.material.Lever; +import org.bukkit.material.MaterialData; +import org.bukkit.material.RedstoneTorch; +import org.bukkit.material.Torch; +import org.bukkit.material.TrapDoor; +import org.bukkit.material.TripwireHook; +import de.diddiz.LogBlock.Consumer; +import de.diddiz.LogBlock.Logging; +import de.diddiz.LogBlock.config.WorldConfig; + +public class LoggingUtil { + + public static void smartLogFallables(Consumer consumer, String playerName, Block origin) { + + WorldConfig wcfg = getWorldConfig(origin.getWorld()); + if (wcfg == null) return; + + //Handle falling blocks + Block checkBlock = origin.getRelative(BlockFace.UP); + int up = 0; + final int highestBlock = checkBlock.getWorld().getHighestBlockYAt(checkBlock.getLocation()); + while (BukkitUtils.getRelativeTopFallables().contains(checkBlock.getTypeId())) { + + // Record this block as falling + consumer.queueBlockBreak(playerName, checkBlock.getState()); + + // Guess where the block is going (This could be thrown of by explosions, but it is better than nothing) + Location loc = origin.getLocation(); + int x = loc.getBlockX(); + int y = loc.getBlockY(); + int z = loc.getBlockZ(); + while (y > 0 && BukkitUtils.canFall(loc.getWorld(), x, (y - 1), z)) { + y--; + } + // If y is 0 then the sand block fell out of the world :( + if (y != 0) { + Location finalLoc = new Location(loc.getWorld(), x, y, z); + // Run this check to avoid false positives + if (!BukkitUtils.getFallingEntityKillers().contains(finalLoc.getBlock().getTypeId())) { + finalLoc.add(0, up, 0); // Add this here after checking for block breakers + if (finalLoc.getBlock().getType() == Material.AIR || BukkitUtils.getRelativeTopFallables().contains(finalLoc.getBlock().getTypeId())) { + consumer.queueBlockPlace(playerName, finalLoc, checkBlock.getTypeId(), checkBlock.getData()); + } else { + consumer.queueBlockReplace(playerName, finalLoc, finalLoc.getBlock().getTypeId(), finalLoc.getBlock().getData(), checkBlock.getTypeId(), checkBlock.getData()); + } + up++; + } + } + if (checkBlock.getY() >= highestBlock) break; + checkBlock = checkBlock.getRelative(BlockFace.UP); + } + } + + public static void smartLogBlockBreak(Consumer consumer, String playerName, Block origin) { + + WorldConfig wcfg = getWorldConfig(origin.getWorld()); + if (wcfg == null) return; + + Block checkBlock = origin.getRelative(BlockFace.UP); + if (BukkitUtils.getRelativeTopBreakabls().contains(checkBlock.getTypeId())) { + if (wcfg.isLogging(Logging.SIGNTEXT) && checkBlock.getType() == Material.SIGN_POST) { + consumer.queueSignBreak(playerName, (Sign) checkBlock.getState()); + } else { + consumer.queueBlockBreak(playerName, checkBlock.getState()); + } + } + + List relativeBreakables = BukkitUtils.getBlocksNearby(origin, BukkitUtils.getRelativeBreakables()); + if (relativeBreakables.size() != 0) { + for (Location location : relativeBreakables) { + final Material blockType = location.getBlock().getType(); + final BlockState blockState = location.getBlock().getState(); + final MaterialData data = blockState.getData(); + switch (blockType) { + case REDSTONE_TORCH_ON: + case REDSTONE_TORCH_OFF: + if (blockState.getBlock().getRelative(((RedstoneTorch) data).getAttachedFace()).equals(origin)) { + consumer.queueBlockBreak(playerName, blockState); + } + break; + case TORCH: + if (blockState.getBlock().getRelative(((Torch) data).getAttachedFace()).equals(origin)) { + consumer.queueBlockBreak(playerName, blockState); + } + break; + case COCOA: + if (blockState.getBlock().getRelative(((CocoaPlant) data).getAttachedFace()).equals(origin)) { + consumer.queueBlockBreak(playerName, blockState); + } + break; + case LADDER: + if (blockState.getBlock().getRelative(((Ladder) data).getAttachedFace()).equals(origin)) { + consumer.queueBlockBreak(playerName, blockState); + } + break; + case LEVER: + if (blockState.getBlock().getRelative(((Lever) data).getAttachedFace()).equals(origin)) { + consumer.queueBlockBreak(playerName, blockState); + } + break; + case TRIPWIRE_HOOK: + if (blockState.getBlock().getRelative(((TripwireHook) data).getAttachedFace()).equals(origin)) { + consumer.queueBlockBreak(playerName, blockState); + } + break; + case WOOD_BUTTON: + case STONE_BUTTON: + if (blockState.getBlock().getRelative(((Button) data).getAttachedFace()).equals(origin)) { + consumer.queueBlockBreak(playerName, blockState); + } + break; + case WALL_SIGN: + if (blockState.getBlock().getRelative(((org.bukkit.material.Sign) data).getAttachedFace()).equals(origin)) { + if (wcfg.isLogging(Logging.SIGNTEXT)) { + consumer.queueSignBreak(playerName, (Sign) blockState); + } else { + consumer.queueBlockBreak(playerName, blockState); + } + } + break; + case TRAP_DOOR: + if (blockState.getBlock().getRelative(((TrapDoor) data).getAttachedFace()).equals(origin)) { + consumer.queueBlockBreak(playerName, blockState); + } + break; + default: + consumer.queueBlockBreak(playerName, blockState); + break; + } + } + } + // Do this down here so that the block is added after blocks sitting on it + consumer.queueBlockBreak(playerName, origin.getState()); + } +}