From 2d97a425e9aad67dc40b754c685b2d67d60d58ee Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 8 Sep 2021 20:28:10 +0200 Subject: [PATCH] Hotfix SmartPlaceListener Signed-off-by: yoyosource --- .../features/smartplace/SmartPlaceListener.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java index 0c9e3997..650389ca 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java @@ -29,6 +29,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Directional; import org.bukkit.block.data.Rotatable; +import org.bukkit.block.data.type.Repeater; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -61,9 +62,20 @@ public class SmartPlaceListener implements Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; - if (event.getPlayer().isSneaking()) return; + if (event.getPlayer().isSneaking()) { + if (event.getClickedBlock().getType() == Material.REPEATER) { + Repeater repeater = (Repeater) event.getClickedBlock().getBlockData(); + int i = repeater.getDelay() - 1; + if (i <= 0) i += 4; + repeater.setDelay(i); + event.getClickedBlock().setBlockData(repeater); + event.setCancelled(true); + } + return; + } if (!event.getClickedBlock().getType().isInteractable()) return; if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return; + if (event.getItem() == null) return; if (!event.getMaterial().isBlock()) return; try {