OpenInv

4M Downloads

When an OpenInv inventory is open, handling InventoryClickEvent for other plugins fail

Brokkonaut opened this issue ยท 3 comments

commented

When having an OpenInv inventory open (in this case the own player inventory), and clicking in the inventory several other plugins fail, because InventoryClickEvent.getClickedInventory() does throw an exception. The stack trace below is just an example from WorldGuard, but about 10 more plugins on our servers throw the same exception.

https://cpaste.de/cuvigabepi.apache

commented

Ah, found it. The problem is that OI rounds the slot count of the upper inventory out to an even number, so when CB counts slots it is a couple short. Actually, looks like CB does some really strange stuff that kinda(TM) works but allows slot numbers that are outside the normal inventory range because of the way they calculate sizes. I sorta get why they did it the way they did (because the Bukkit Inventory API has really not aged well and doesn't correlate well to what goes on under the hood) but I'm going to just not use CB's code here at all.

commented

Could you please try with a more recent build and let me know if you still have issues? I made several improvements to views a little after 5.0.0 released.

This should be specific to the player's own inventory, because that view is a view of a subsection of a larger inventory.

commented

Thanks for the quick fix ๐Ÿ‘