From 8f1333945d8cae6cd9058d1521f7acefb03f2b34 Mon Sep 17 00:00:00 2001 From: singh Date: Thu, 16 May 2024 21:50:53 +0530 Subject: [PATCH] [Fixed] Duplication glitch fixed while breaking stacked blocks while sneaking. --- UltimateStacker-Plugin/pom.xml | 2 +- .../listeners/BlockListeners.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UltimateStacker-Plugin/pom.xml b/UltimateStacker-Plugin/pom.xml index 9eb36c9..890bf86 100644 --- a/UltimateStacker-Plugin/pom.xml +++ b/UltimateStacker-Plugin/pom.xml @@ -16,7 +16,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.1 + 3.5.3 diff --git a/UltimateStacker-Plugin/src/main/java/com.craftaro.ultimatestacker/listeners/BlockListeners.java b/UltimateStacker-Plugin/src/main/java/com.craftaro.ultimatestacker/listeners/BlockListeners.java index ee5141f..cf142be 100644 --- a/UltimateStacker-Plugin/src/main/java/com.craftaro.ultimatestacker/listeners/BlockListeners.java +++ b/UltimateStacker-Plugin/src/main/java/com.craftaro.ultimatestacker/listeners/BlockListeners.java @@ -108,8 +108,8 @@ public class BlockListeners implements Listener { //Remove all items from stack int amountToRemove = Math.min(Settings.MAX_REMOVEABLE.getInt(), stack.getAmount()); ItemStack removed = stack.getMaterial().parseItem(); - removed.setAmount(amountToRemove); - stack.take(amountToRemove); + removed.setAmount(amountToRemove-1); + stack.take(amountToRemove-1); if (Settings.ADD_TO_INVENTORY.getBoolean()) { player.getInventory().addItem(removed); } else { @@ -124,7 +124,7 @@ public class BlockListeners implements Listener { player.getWorld().dropItemNaturally(block.getLocation(), stack.getMaterial().parseItem()); } } - if (stack.getAmount() == 1) { + if (stack.getAmount() <= 1) { //Remove stack stack.destroy(); return;