SamJakob/SpiGUI

Plugin does not check if the clicked inventory is the actual GUI

MCreeper12731 opened this issue · 4 comments

There is a known issue in Spigot when checking the inventory's clicked slot number because of the slot numbering system (picture included)
image
I fixed this issue by adding an additional fix
if (event.getClickedInventory() == null || event.getClickedInventory().getType() == InventoryType.PLAYER) return;
which checks if the inventory that was clicked was actually the upper part of the UI, otherwise the listener also let's through clicks that were done in the player inventory and act as if they were done in the GUI. But adding this everytime is a bit tedious. Sorry if the explanation is a bit confusing, I can go over certain parts again if you don't understand the problem

Oh I see what you mean. I recall this issue and must have just forgotten to implement a fix for this. I can’t do anything on this for the next couple of weeks but after I might be able to take a look.

Otherwise if you can submit a PR I’m happy to merge.

Submitted a PR, I hope I did everything correctly, I'm still new to GitHub
Fixed in #20

Thanks for your PR just had a look and noticed a potentially simpler way of doing it. Replied to #20

Closed with #20.