-
-
Notifications
You must be signed in to change notification settings - Fork 27
Don't cancel single slot drag event click #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thank you for your PR and while it seems to make sense (as the single slot drag is forwarded as a click but then cancelled here by the event instance chec) I cannot reproduce any issue with the current implementation which is a bit confusing to me and I want to figure out why it's not actually causing an issue for me first before merging. |
|
Thanks for a quick response! InventoryGui gui = new InventoryGui(this, null, "", new String[]{
"ggggggggg",
"ggggggggg",
"ggggggggg",
"ggggggggg",
"ggggggggg",
"ggggggggg",
});
GuiElementGroup group = new GuiElementGroup('g');
Inventory inventory = Bukkit.createInventory(null, 54);
for (int i = 0; i < 54; i++) {
group.addElement(new GuiStorageElement('e', inventory, i));
}
gui.addElement(group);
gui.show(player);When having an itemstack on the cursor and right clicking on each slot, this happens: (I clicked once on each slot, eventually the item will go through) |
|
Thanks for providing the additional info. My guess right now is that this is caused by using a group instead of the GuiStorageElement directly so the click would get passed through the group first which could potentially change behaviour and cause what you describe. I only tested with a direct storage element before. (your example should be able to not use a group at all as the GuiStorageElement would automatically map the slots to the slots in the inventory but of course storage inside groups should be properly fixed too) |
|
Can you please re-test if the latest changes to the library (1.6.5 release) fixes your issues already without this additional PR? |
Unfortunately it appears that the issue is still there. I tested it on version 1.20.4 though (added a startup flag), could that be the problem? |
You need to test on 1.21.9+ as server versions previous to this have a bug which makes handling inventories correctly not possible. |
The problem:
When placing an item with a "drag" (the InventoryDragEvent) onto GuiStorageElement, it will always get canceled. Placing a single item with drag event is undistinguishable to a player from a regular inventory click. This creates a weird bug where sometimes item just won't get placed into storage.
This is a fix.