[Fixed] Duplication glitch fixed while breaking stacked blocks while sneaking.

This commit is contained in:
singh 2024-05-16 21:50:53 +05:30
parent 37de2676a6
commit 8f1333945d
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version> <version>3.5.3</version>
<executions> <executions>
<execution> <execution>

View File

@ -108,8 +108,8 @@ public class BlockListeners implements Listener {
//Remove all items from stack //Remove all items from stack
int amountToRemove = Math.min(Settings.MAX_REMOVEABLE.getInt(), stack.getAmount()); int amountToRemove = Math.min(Settings.MAX_REMOVEABLE.getInt(), stack.getAmount());
ItemStack removed = stack.getMaterial().parseItem(); ItemStack removed = stack.getMaterial().parseItem();
removed.setAmount(amountToRemove); removed.setAmount(amountToRemove-1);
stack.take(amountToRemove); stack.take(amountToRemove-1);
if (Settings.ADD_TO_INVENTORY.getBoolean()) { if (Settings.ADD_TO_INVENTORY.getBoolean()) {
player.getInventory().addItem(removed); player.getInventory().addItem(removed);
} else { } else {
@ -124,7 +124,7 @@ public class BlockListeners implements Listener {
player.getWorld().dropItemNaturally(block.getLocation(), stack.getMaterial().parseItem()); player.getWorld().dropItemNaturally(block.getLocation(), stack.getMaterial().parseItem());
} }
} }
if (stack.getAmount() == 1) { if (stack.getAmount() <= 1) {
//Remove stack //Remove stack
stack.destroy(); stack.destroy();
return; return;