Fix inventory desync by waiting 1 tick.#53
Open
DungeonDev wants to merge 2 commits intolMartin3:masterfrom
Open
Fix inventory desync by waiting 1 tick.#53DungeonDev wants to merge 2 commits intolMartin3:masterfrom
DungeonDev wants to merge 2 commits intolMartin3:masterfrom
Conversation
…licked" ItemStack is not consistent.
Contributor
|
Tested it just now. Works fine! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #52
Reading the following from the Bukkit API:
I'm personally not the most experienced when it comes to working with Bukkit, but the current InventoryClickEvent handler does in fact call both closeInventory and openInventory, which is why I followed the API:s recommendation and delayed execution of openShulkerBoxInventory by 1 tick. For safety, I also added a check to make sure that the item right-clicked has not changed since the click, as clients otherwise have a 1 tick window to do bad stuff, such as replacing the shulker being opened.
This is the solution used by me on my personal server, if there is a better solution someone more experienced can come up with, I'd be all ears.
All in all I'd still recommend more testing to make sure that there isn't any edge-cases where items can be duplicated.