You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example contains a Map<Player,InventoryView>, and even has a comment (shown below) explaining that using Player objects as keys and values is bad design, so could it just be changed to use player ids?
// A map to store all inventory views in. Generally it is not recommended// to use Player objects as keys or values, but in this case it is acceptable// because the inventory view is also bound to a player object, meaning we// couldn't reuse it after a player rejoins anyways.
Also, could there be an example for listening to an InventoryClickEvent? It's not that necessary, since the same sort of logic is displayed in the PlayerQuitEvent handler. If it were to be added, it could prevent you from putting shulker boxes in your stash.
Just realized a better reason for the InventoryClickEvent demo is to show how you can check if a clicked view is a custom view. There's obviously title comparison, but other than that you'd need to maintain a list of all the players who have the menu open.
This should be able to be done by adding a UUID to a set when they view is opened then removing it with an InventoryCloseEvent listener.
Activity
TurboJax commentedon Sep 21, 2026
Just realized a better reason for the InventoryClickEvent demo is to show how you can check if a clicked view is a custom view. There's obviously title comparison, but other than that you'd need to maintain a list of all the players who have the menu open.
This should be able to be done by adding a UUID to a set when they view is opened then removing it with an InventoryCloseEvent listener.