diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java index 15f0a005..0f1cfe5e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java @@ -50,13 +50,18 @@ public class PistonCalculator implements Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; - if (event.getPlayer().getInventory().getItemInMainHand().getType() != Material.SLIME_BALL) return; + if (!event.hasItem() || event.getItem().getType() != Material.SLIME_BALL) return; if (event.getClickedBlock() == null) return; Block clickedBlock = event.getClickedBlock(); Material blockType = clickedBlock.getType(); if (!(blockType == Material.PISTON || blockType == Material.STICKY_PISTON)) return; Piston piston = (Piston) clickedBlock.getBlockData(); + if (blockType == Material.PISTON && piston.isExtended()) { + BauSystem.MESSAGE.sendPrefixless("PISTON_INFO", event.getPlayer(), ChatMessageType.ACTION_BAR, "§a", 0); + return; + } + boolean pulling = blockType == Material.STICKY_PISTON && (clickedBlock.getRelative(piston.getFacing()).getType() == Material.AIR || piston.isExtended()); CalculationResult result = calc(clickedBlock, piston.getFacing(), (pulling ? piston.getFacing().getOppositeFace() : piston.getFacing()));