mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-03 23:17:48 +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;
|
return null;
|
||||||
|
|
||||||
var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
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();
|
return !result.isCancel();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ public class InventoryClickProcessor {
|
|||||||
var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
||||||
if (index == slot) // Prevent item lose/duplication
|
if (index == slot) // Prevent item lose/duplication
|
||||||
return false;
|
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();
|
return !result.isCancel();
|
||||||
}, start, end, step);
|
}, start, end, step);
|
||||||
|
|
||||||
@ -547,6 +547,13 @@ public class InventoryClickProcessor {
|
|||||||
return startCondition(clickResult, inventory, player, slot, clickType);
|
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,
|
private void callClickEvent(@NotNull Player player, @Nullable Inventory inventory, int slot,
|
||||||
@NotNull ClickType clickType, @NotNull ItemStack clicked, @NotNull ItemStack cursor) {
|
@NotNull ClickType clickType, @NotNull ItemStack clicked, @NotNull ItemStack cursor) {
|
||||||
InventoryClickEvent inventoryClickEvent = new InventoryClickEvent(inventory, player, slot, clickType, clicked, cursor);
|
InventoryClickEvent inventoryClickEvent = new InventoryClickEvent(inventory, player, slot, clickType, clicked, cursor);
|
||||||
|
Loading…
Reference in New Issue
Block a user