mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-02 17:00:41 +01:00
Fix shift clicks not being cancelled
This commit is contained in:
parent
098a12961d
commit
b662e331f0
@ -186,7 +186,7 @@ public class InventoryClickProcessor {
|
||||
return null;
|
||||
|
||||
var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
||||
InventoryClickResult result = startCondition(inventory, player, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
||||
InventoryClickResult result = startCondition(targetInventory, player, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
||||
return !result.isCancel();
|
||||
});
|
||||
|
||||
@ -209,7 +209,7 @@ public class InventoryClickProcessor {
|
||||
var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
||||
if (index == slot) // Prevent item lose/duplication
|
||||
return false;
|
||||
InventoryClickResult result = startCondition(null, player, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
||||
InventoryClickResult result = startCondition(targetInventory, player, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
||||
return !result.isCancel();
|
||||
}, start, end, step);
|
||||
|
||||
@ -547,6 +547,13 @@ public class InventoryClickProcessor {
|
||||
return startCondition(clickResult, inventory, player, slot, clickType);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private InventoryClickResult startCondition(@Nullable AbstractInventory inventory, @NotNull Player player, int slot,
|
||||
@NotNull ClickType clickType, @NotNull ItemStack clicked, @NotNull ItemStack cursor) {
|
||||
return startCondition(inventory instanceof Inventory ? (Inventory) inventory : null,
|
||||
player, slot, clickType, clicked, cursor);
|
||||
}
|
||||
|
||||
private void callClickEvent(@NotNull Player player, @Nullable Inventory inventory, int slot,
|
||||
@NotNull ClickType clickType, @NotNull ItemStack clicked, @NotNull ItemStack cursor) {
|
||||
InventoryClickEvent inventoryClickEvent = new InventoryClickEvent(inventory, player, slot, clickType, clicked, cursor);
|
||||
|
Loading…
Reference in New Issue
Block a user