mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-17 05:31:23 +01:00
Fix shift click ghost item when click is cancelled
This commit is contained in:
parent
47e7d35949
commit
ec9658e7d3
@ -352,6 +352,10 @@ public class Inventory extends AbstractInventory implements Viewable {
|
|||||||
playerInventory.setItemStack(clickSlot, clickResult.getClicked());
|
playerInventory.setItemStack(clickSlot, clickResult.getClicked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(clickResult.doRefresh()){
|
||||||
|
update(player);
|
||||||
|
}
|
||||||
|
|
||||||
refreshPlayerCursorItem(player, clickResult.getCursor());
|
refreshPlayerCursorItem(player, clickResult.getCursor());
|
||||||
|
|
||||||
return !clickResult.isCancel();
|
return !clickResult.isCancel();
|
||||||
|
@ -187,7 +187,11 @@ public class InventoryClickProcessor {
|
|||||||
|
|
||||||
var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
||||||
InventoryClickResult result = startCondition(targetInventory, player, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
InventoryClickResult result = startCondition(targetInventory, player, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
||||||
return !result.isCancel();
|
if(result.isCancel()){
|
||||||
|
clickResult.setRefresh(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
ItemStack itemResult = TransactionOption.ALL.fill(targetInventory, pair.left(), pair.right());
|
ItemStack itemResult = TransactionOption.ALL.fill(targetInventory, pair.left(), pair.right());
|
||||||
@ -210,7 +214,11 @@ public class InventoryClickProcessor {
|
|||||||
if (index == slot) // Prevent item lose/duplication
|
if (index == slot) // Prevent item lose/duplication
|
||||||
return false;
|
return false;
|
||||||
InventoryClickResult result = startCondition(targetInventory, player, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
InventoryClickResult result = startCondition(targetInventory, player, index, ClickType.SHIFT_CLICK, itemStack, cursor);
|
||||||
return !result.isCancel();
|
if(result.isCancel()){
|
||||||
|
clickResult.setRefresh(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}, start, end, step);
|
}, start, end, step);
|
||||||
|
|
||||||
ItemStack itemResult = TransactionOption.ALL.fill(targetInventory, pair.left(), pair.right());
|
ItemStack itemResult = TransactionOption.ALL.fill(targetInventory, pair.left(), pair.right());
|
||||||
|
Loading…
Reference in New Issue
Block a user