mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-23 10:35:22 +01:00
Fix block stack dupe/item liss
This commit is contained in:
parent
a43230f3b1
commit
f51cc19c44
@ -86,6 +86,7 @@ public class DataManager extends DataManagerAbstract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateBlock(BlockStack blockStack) {
|
public void updateBlock(BlockStack blockStack) {
|
||||||
|
if (blockStack.getAmount() == 0) return;
|
||||||
this.runAsync(() -> {
|
this.runAsync(() -> {
|
||||||
try (Connection connection = this.databaseConnector.getConnection()) {
|
try (Connection connection = this.databaseConnector.getConnection()) {
|
||||||
String updateBlock = "UPDATE " + this.getTablePrefix() + "blocks SET amount = ? WHERE id = ?";
|
String updateBlock = "UPDATE " + this.getTablePrefix() + "blocks SET amount = ? WHERE id = ?";
|
||||||
|
@ -74,7 +74,7 @@ public class BlockListeners implements Listener {
|
|||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (!isStacked) plugin.getDataManager().createBlock(stack);
|
if (!isStacked) plugin.getDataManager().createBlock(stack);
|
||||||
if (stack.getMaterial() == CompatibleMaterial.getMaterial(inHand)) {
|
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++;
|
if (!isStacked) amountToAdd++;
|
||||||
stack.add(amountToAdd);
|
stack.add(amountToAdd);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user