Merge pull request #6 from TeamHRLive/development

[Fixed] Duplication glitch fixed while breaking stacked blocks while sneaking.
This commit is contained in:
ceze88 2024-05-16 19:19:44 +02:00 committed by GitHub
commit f1b28bda80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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;