mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-02 17:00:41 +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());
|
||||
}
|
||||
|
||||
if(clickResult.doRefresh()){
|
||||
update(player);
|
||||
}
|
||||
|
||||
refreshPlayerCursorItem(player, clickResult.getCursor());
|
||||
|
||||
return !clickResult.isCancel();
|
||||
|
@ -187,7 +187,11 @@ public class InventoryClickProcessor {
|
||||
|
||||
var pair = TransactionType.ADD.process(targetInventory, clicked, (index, itemStack) -> {
|
||||
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());
|
||||
@ -210,7 +214,11 @@ public class InventoryClickProcessor {
|
||||
if (index == slot) // Prevent item lose/duplication
|
||||
return false;
|
||||
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);
|
||||
|
||||
ItemStack itemResult = TransactionOption.ALL.fill(targetInventory, pair.left(), pair.right());
|
||||
|
Loading…
Reference in New Issue
Block a user