hollow-cube / minestom-ce

1.20.4 Lightweight Minecraft server
https://minestom.net
Apache License 2.0
107 stars 35 forks source link

Shift click behavior #129

Closed lordtgm closed 9 months ago

lordtgm commented 9 months ago

currently this is the behavior for shift clicks: first an InventoryPreClickEvent is called for the source inventory/slot. then for each slot in the target inventory capable of receiving the item, InventoryPreClickEvent is called. however the changes in clicked item and cursor item in both of these are ignored and only cancellation takes effect. then, for each changed slot InventoryClickEvent is called, without any event being called for the source slot. this is the behavior I suggest: an InventoryPreClickEvent is called with additional Inventory getTargetInventory(), Map<Integer, ItemStack> getChangeMap() and void setChangeMap(Map<Integer, ItemStack> changeMap) methods (either through a subclass InventoryPreShiftClickEvent or in the InventoryPreClickEvent class itself, returning null for other clicks). this event contains regular fields about the source slot/item/inventory, alongside the target inventory and its changes. both the source item and the change map can be replaced. then the changes are applied and an InventoryClickEvent is called with the applied changes.

iam4722202468 commented 9 months ago

Closing because this isn't a bug, it's a suggestion. You can repost this in Discussions.