How can you check if the inventory of the player is open (Minecraft) Thanks in advance?
My knowledge in the field are already a few years old, have previously written such plugins, but to my knowledge (and the knowledge of short googling), there's an event system at Spigot and there a https://hub.spigotmc.org/...Event.html and https://hub.spigotmc.org/...Event.html there you can get the opened or closed https://hub.spigotmc.org/...ntory.html object via getInventory () and get the https://hub.spigotmc.org/...yType.html via getType () and then you can check if it is a player inventory (ie InventoryType.PLAYER) or not.
Now when do you know when player inventories are opened and closed? Then you simply write the player into a list when he opens his player inventory and remove it when he closes it and voila: If you want to know if he has his inventory open or not, just look if he's in the list or not,
And zack, finished - query whether the inventory of the player is open.
Well, but so I want to ask if the inventory of self is open and if so he gets a message how does it work?
I do not understand the question. These events i. The InventoryOpen event is "triggered" to my understanding when an inventory opens on the player, even if he does it himself, i. E. Pressing the appropriate key will fire that event and then you can catch that. https://www.spigotmc.org/...event-api/
If you just want to send a message when the player opens their inventory then it might look something like this:
@Override
public void onEnable ()
{
getServer (). GetPluginManager (). RegisterEvents (new MyListener (), this);
} // Add this to the existing onEnable ()
public class MyListener implements Listener
{
@EventHandler
public void onPlayerInventory (InventoryOpenEvent event)
{
if (event.getInventory (). GetType () == InventoryType.PLAYER) {
event.getPlayer (). SendMessage ("Ravioli, Ravioli, Give Me the Formilioli.");
}
}
}
Should that not answer the question you should become a little more specific…
Nope that does not work somehow so, I want to make an anti-cheat and there now just an InventoryMove check as if the event works at all I want to receive a message only that happens stop and no matter what I try or as a test whether the query is true at all my Inventory is currently open.
Will the message be displayed when opening the inventory?
No
im also seaching