Fix block stack dupe/item liss

This commit is contained in:
ceze88 2023-04-05 22:05:14 +02:00
parent a43230f3b1
commit f51cc19c44
2 changed files with 2 additions and 1 deletions

View File

@ -86,6 +86,7 @@ public class DataManager extends DataManagerAbstract {
}
public void updateBlock(BlockStack blockStack) {
if (blockStack.getAmount() == 0) return;
this.runAsync(() -> {
try (Connection connection = this.databaseConnector.getConnection()) {
String updateBlock = "UPDATE " + this.getTablePrefix() + "blocks SET amount = ? WHERE id = ?";

View File

@ -74,7 +74,7 @@ public class BlockListeners implements Listener {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (!isStacked) plugin.getDataManager().createBlock(stack);
if (stack.getMaterial() == CompatibleMaterial.getMaterial(inHand)) {
int amountToAdd = player.isSneaking() || Settings.ALWAYS_ADD_ALL.getBoolean() ? inHand.getAmount() : 1;
int amountToAdd = player.isSneaking() || Settings.ALWAYS_ADD_ALL.getBoolean() ? inHand.getAmount()-1 : 1;
if (!isStacked) amountToAdd++;
stack.add(amountToAdd);
event.setCancelled(true);