InventoryCloseEvent should fire when the player closes their inventory.
InventoryCloseEvent is never fired.
1.) Create and register an InventoryCloseEvent.
2.) Set it to output a debug message.
3.) Open inventory via e then close it via e or ESC
4.) Debug message is never sent to the console.
ItemJoin -- I am the developer of this and was notified that features utilizing InventoryCloseEvent stopped working in paper when the users updated their paper version.
The build number is the latest (b374).
=> This is the 1.15 branch.
The issue doesn't occur in b365, so the bug appeared somewhere between b365 and b374.
Let me know if you need additional information, to me, it seems pretty simple but I often don't explain things very well.
Inventory events don't fire for player-only inventories. That is entirely client side iirc.
For certain player-only inventory events (Such as InventoryOpenEvent) yes, however for the InventoryCloseEvent--it is supposed to fire.
In any version below b365 this event used to work but as of updating to b374 it has stopped working. If it was strictly client-sided then why would it work in b365 in the first place?
Yeah, ok. looks like it broke on build 371
More specifically, looks like md_5's fix for SPIGOT-5799 caused it.
Oh wow, so I wasn't crazy when InventoryCloseEvent didnt fire for me. I swore it was working a while back.
Are you talking specifically at player quit, and only for type == player?
we talked over this, it is iffy.
Essentially, you're wanting to react to a client packet, and not really a server state change (because to the server, nothing has changed)
This may be best for you to use protocol lib for instead and react to the packet directly.
But what I don't understand is why it is broken in the first place, it originally worked before MD_5's commit to fix another bug. Essentially the bug fix ended up creating an additional bug did it not?
Since MC 1.7 the result of a player closing their inventory would result in the event being triggered. Are we simply transitioning away from this to only fire when a player has an open inventory via chest such as how the InventoryOpenEvent functions?
I have currently been using an implementation of the TinyProtocol class to temporarily negate this issue but a lot of other developers still use the InventoryCloseEvent and its probably going to keep reappearing as an issue.
Thanks for the quick replies.
I guess the argument is, that since there isn't an open event for a player's inventory, there shouldn't be a close one
going to close as wontfix because it was technically a bug in first place.
Please use protocol lib and listen to the close packet if you really want to do this.
Fixed in CraftBukkit 5c77bd28168.
Most helpful comment
Yeah, ok. looks like it broke on build 371
More specifically, looks like md_5's fix for SPIGOT-5799 caused it.