diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 24fb25bc6..537935d41 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -106,15 +106,13 @@ public class BlockListener implements Listener { // If we're pulling a slime block, it might have something attached to it! if (movedBlock.getRelative(direction).getState().getType() == Material.SLIME_BLOCK) { - // Check if any other slime blocks are attached, because they can also pull blocks - List adjacentBlocks = BlockUtils.getAdjacentBlocks(movedBlock.getRelative(direction), Material.SLIME_BLOCK); - for (Block b : adjacentBlocks) { - new StickyPistonTrackerTask(direction, event.getBlock(), b).runTaskLater(plugin, 2); + for (Block block : event.getBlocks()) { +// // Treat the slime blocks as if it is the sticky piston itself, because pulling +// // a slime block with a sticky piston is effectively the same as moving a sticky piston. + new StickyPistonTrackerTask(direction, event.getBlock(), block).runTaskLater(plugin, 2); } - // Treat the slime block as if it is the sticky piston itself, because pulling - // a slime block with a sticky piston is effectively the same as moving a sticky piston. - movedBlock = movedBlock.getRelative(direction); + return; } // Needed only because under some circumstances Minecraft doesn't move the block diff --git a/src/main/java/com/gmail/nossr50/util/BlockUtils.java b/src/main/java/com/gmail/nossr50/util/BlockUtils.java index 8b87e7e26..277baefc9 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockUtils.java +++ b/src/main/java/com/gmail/nossr50/util/BlockUtils.java @@ -1,14 +1,10 @@ package com.gmail.nossr50.util; -import java.util.ArrayList; import java.util.HashSet; -import java.util.List; import org.bukkit.CropState; import org.bukkit.Material; import org.bukkit.NetherWartsState; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.material.CocoaPlant; import org.bukkit.material.CocoaPlant.CocoaPlantSize; @@ -320,32 +316,6 @@ public final class BlockUtils { return type == Material.PISTON_MOVING_PIECE || type == Material.AIR; } - /** - * Get the adjacent blocks of the base block if it is equal to a certain material - * - * @param base The base block to check - * @param material The Material to check for - * @return a list with the adjacent blocks - */ - public static List getAdjacentBlocks(Block base, Material material) { - List blocks = new ArrayList(); - - if (base.getRelative(BlockFace.NORTH).getType() == material) { - blocks.add(base.getRelative(BlockFace.NORTH)); - } - if (base.getRelative(BlockFace.EAST).getType() == material) { - blocks.add(base.getRelative(BlockFace.EAST)); - } - if (base.getRelative(BlockFace.SOUTH).getType() == material) { - blocks.add(base.getRelative(BlockFace.SOUTH)); - } - if (base.getRelative(BlockFace.WEST).getType() == material) { - blocks.add(base.getRelative(BlockFace.WEST)); - } - - return blocks; - } - /** * Get a HashSet containing every transparent block *