Hello so I've had this problem for awhile now, how would I go about checking this? InventoryOpenEvent does not fire for the players inventory. I've also tried: Code (Text): if (player.getOpenInventory() instanceof PlayerInventory) { } Does not work. I know this is possible, would I use packets, and which one? I already have experience with ProtocolLib and have it setup. Thanks for all the help.
You can use the event https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryOpenEvent.html and check the name of the inventory... the inventory user is a name default...
if its doesn't work it means that you don't made it correctly don't just tell that please read the read if he don't read the thread he won't tell you a great answear indeed for me. Code (Java): InventoryOpenEvent if(e.getInventory() instanceof PlayerInventory) { // do something }
It's unfortunately not possible to tell whether or not the player actually has their inventory open, and it's always considered open.
then do this thing inside the event Code (Java): Player p = (Player) e.getPlayer(); p.closeInventory(Inventory inventory);
How is that going to help? 1) The player inventory is in a constant open state. 2) He still wouldn't be able to tell if they opened their inventory
you can tell it from the inventoryopenevent using if (e.getInventory()) // get the inventory opened by player.
Yes. But he's talking about the player's own inventory, which is never closed nor opened, meaning it's in a constant open state. And he wants to know whether or not the player has their inventory open.
Notchian clients send a packet when they open the inventory so the server can handle the archievement. Capture that using protocollib and profitö
I've though of doing that, theres also an event, but I feel as if its ghetto in a way. Thanks anyway!