[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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.3</version>
<executions>
<execution>

View File

@ -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;