-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bukkit.createInventory() is weird #9892
Comments
This is not a bug as much as it's long missing functionality from bukkit, not all createInventory method calls will end up creating a "real" inventory of a specific type, right now, you have an inventory that looks like an anvil, but has literally 0 of its functionality, the only reason you see anything happening otherwise is because the client has its own logic which "predicts" the outcome |
You probably want to use this "family" of methods instead because it opens real inventories |
I have searched some posts and found the problem has been persisted for a long time, as discussed in this SpigotMC post. |
There is a way, the openAnvil method that was mentioned above your post. You can customize the title too with the InventoryOpenEvent title override. |
Closing as a duplicate of #5825, use the openAnvil method instead as a workaround |
Expected behavior
After creating an anvil inventory with the Bukkit.createInventory() method, PrepareAnvilEvent must be called when controlled after it is opened to the player.
Observed/Actual behavior
However, PrepareAnvilEvent is not actually called and the inventory behaves as if the InventoryClickEvent was cancelled, and the item disappears on SHIFT+LEFT click control.
Steps/models to reproduce
The code is like this:
Plugin and Datapack List
Paper version
Other
No response
The text was updated successfully, but these errors were encountered: