It looks like the reason for the bug is a mismatch in the mappings for some of the NMS wrappers. Specifically, closeContainer was being called instead of doCloseContainer, which will lead to the InventoryCloseEvent firing an extra time (should be pretty clear if you look at the code in an IDE so you can jump between the relevant methods). The comment makes it pretty clear that doCloseContainer is what should be called, not closeContainer (in fact, if you look at the other wrappers, even all the way back to 1.8, this has always been the case). The mappings are mismatched in the 1_20_R3 wrapper and the 1_21_R1 wrapper, but not the 1_20_R4 wrapper or any other version I could find. For reference, here is the mapping history, you can search for "doCloseContainer" to find all the changes.
So basically, before this fix, on specifically Minecraft 1.20.3, 1.20.4 and 1.21, closeContainer was called instead of doCloseContainer, which caused the close event to be fired twice instead of once.
Fixes #339
It looks like the reason for the bug is a mismatch in the mappings for some of the NMS wrappers. Specifically,
closeContainer
was being called instead ofdoCloseContainer
, which will lead to theInventoryCloseEvent
firing an extra time (should be pretty clear if you look at the code in an IDE so you can jump between the relevant methods). The comment makes it pretty clear thatdoCloseContainer
is what should be called, notcloseContainer
(in fact, if you look at the other wrappers, even all the way back to 1.8, this has always been the case). The mappings are mismatched in the1_20_R3
wrapper and the1_21_R1
wrapper, but not the1_20_R4
wrapper or any other version I could find. For reference, here is the mapping history, you can search for "doCloseContainer" to find all the changes.So basically, before this fix, on specifically Minecraft 1.20.3, 1.20.4 and 1.21,
closeContainer
was called instead ofdoCloseContainer
, which caused the close event to be fired twice instead of once.