diff --git a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java index ac2fc3c..8f1e29b 100644 --- a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java +++ b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java @@ -177,7 +177,7 @@ public class Properties { @ConfigurationComment("Do you want to turn off the default sign protection? Warning! Other players will be able to destroy other people's shops!") public static boolean TURN_OFF_SIGN_PROTECTION = false; - @ConfigurationComment("Do you want to disable the hopper protection, which prevents the hoppers from taking items out of chests?") + @ConfigurationComment("Do you want to disable the hopper protection, which prevents Hopper-Minecarts from taking items out of shops?") public static boolean TURN_OFF_HOPPER_PROTECTION = false; @ConfigurationComment("Do you want to protect shop chests with LWC?") diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/BlockPlace.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/BlockPlace.java index b6863d7..781734d 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/BlockPlace.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/BlockPlace.java @@ -8,16 +8,19 @@ import com.Acrobot.ChestShop.Utils.uBlock; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Directional; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; +import java.util.ArrayList; +import java.util.List; + /** * @author Acrobot */ public class BlockPlace implements Listener { - private static BlockFace[] SEARCH_DIRECTIONS = {BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.UP, BlockFace.DOWN}; @EventHandler(ignoreCancelled = true) public static void onContainerPlace(BlockPlaceEvent event) { @@ -66,7 +69,18 @@ public class BlockPlace implements Listener { return; } - for (BlockFace face : SEARCH_DIRECTIONS) { + List searchDirections = new ArrayList<>(); + switch (placed.getType()) { + case HOPPER: + searchDirections.add(BlockFace.UP); + searchDirections.add(((Directional) placed.getBlockData()).getFacing()); + break; + case DROPPER: + searchDirections.add(((Directional) placed.getBlockData()).getFacing()); + break; + } + + for (BlockFace face : searchDirections) { Block relative = placed.getRelative(face); if (!uBlock.couldBeShopContainer(relative)) { diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Item/ItemMoveListener.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Item/ItemMoveListener.java index 112a62b..4bcb998 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Item/ItemMoveListener.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Item/ItemMoveListener.java @@ -1,6 +1,7 @@ package com.Acrobot.ChestShop.Listeners.Item; import com.Acrobot.ChestShop.Signs.ChestShopSign; +import org.bukkit.block.BlockState; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -13,7 +14,7 @@ public class ItemMoveListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public static void onItemMove(InventoryMoveItemEvent event) { - if (event.getSource() == null) { + if (event.getSource() == null || event.getDestination().getHolder() instanceof BlockState) { return; }