mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-16 21:21:22 +01:00
Fix duplication glitch with shift-click
This commit is contained in:
parent
9e5fadaa0e
commit
571624a952
@ -142,16 +142,18 @@ public final class InventoryClickProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
clickResult.setCancel(true);
|
||||
final var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
||||
if (inventory == targetInventory && index == slot)
|
||||
return false; // Prevent item lose/duplication
|
||||
InventoryClickResult result = startCondition(player, targetInventory, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
||||
if (result.isCancel()) {
|
||||
clickResult.setCancel(true);
|
||||
return false;
|
||||
}
|
||||
clickResult.setCancel(false);
|
||||
return true;
|
||||
}, start, end, step);
|
||||
|
||||
ItemStack itemResult = TransactionOption.ALL.fill(targetInventory, pair.left(), pair.right());
|
||||
clickResult.setClicked(itemResult);
|
||||
return clickResult;
|
||||
|
Loading…
Reference in New Issue
Block a user