[SPIGOT-5070] isOpenable for InventoryHolder Created: 14/Jun/19 Updated: 20/Jun/19 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | Priority: | Minor |
Reporter: | Photon | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 1 |
Labels: | Inventory, Openable |
Version: | This server is running CraftBukkit version git-Spigot-df0eb25-411609d (MC: 1.14.2) (Implementing API version 1.14.2-R0.1-SNAPSHOT) |
Guidelines Read: | Yes |
Description |
Please add a method to check if a certain InventoryHolder's Inventory can be opened because there are several hard-to-check-for ways that this could be blocked:
Therefore an isOpenable method that checks on the serverside if a player would be able to open a certain container would be very helpful and makes code much more elegant as lots of special cases could be avoided. |
Comments |
Comment by Yannick Lamprecht [ 20/Jun/19 ] |
I assume you want to check the holder isOpenable before you access the container using Player#openInventory ? |
Comment by Cynthia Yantis [ 16/Jun/19 ] |
I feel as if this would only be used in a select few cases, and anyways, why would you not just listen for an InventoryOpenEvent and then modify that? To me it seems like an easier solution on both ends of the situation. |