#Why does InventoryOpenEvent doesn't fire?

1 messages ยท Page 1 of 1 (latest)

stiff mist
#

`` @EventHandler
public void onInventoryOpen(InventoryOpenEvent e){
Bukkit.broadcastMessage("open");
Player p = (Player) e.getPlayer();

    //If the player is AFK, disable AFK
    if(main.afkManager.isAFK(p.getUniqueId())) main.afkManager.disableAFK(p,System.currentTimeMillis());
}``
dapper niche
#

is it registered

stiff mist
#

yes its part of InventoryInteractListener
I register it at the main class: getServer().getPluginManager().registerEvents(new InventoryInteractListener(this),this);

digital kernel
#

i dont get what youre doing there? the eventhandler listens for an inventory to open, it does not open one

#

do you actually want that

stiff mist
#

I want to detect when a player opens their inventory do disable them being 'afk'

digital kernel
#

yeah

#

tthen its all g

dapper niche
#

are there any console errors

stiff mist
#

nope

#

when i open my inventory it should work?

#

oh wait
I think it only works with other inventories

#

like a chest

dapper niche
#

No it should work

stiff mist
#

for some reason it only fires when I open containers

dapper niche
#

No

#

Something else must be wrong in your code

#

?paste

stiff mist
languid seal
#

inventory open event does not fire fore player inventories

#

the client never notifies the server about it

stiff mist
#

ah

languid seal
#

only time that really happens is if the player is riding an entity that has an inventory, e.g. a llama or donkey

stiff mist
#

so I don't have a reason to listen to that event since I already listen to PlayerInteractEvent and that would detect opening containers

dapper niche
#

spigot should entirely rewrite minecraft

languid seal
#

have you seen creative mode xD

stiff mist
#

creative mode is a mess

languid seal
#

an absolute security nightmare

#

but yea, basically that inventory is fired if any server owned inventory is opened

#

such as a vehicle inventory

stiff mist
#

I see

#

thanks for the help!

languid seal
#

๐Ÿ‘

dapper niche
willow geyser
#

you can listen to the taking inventory achievement but it requires a lot of packet stuff

dapper niche
#

Wouldnt that only be called once

willow geyser
#

it gets called every time you open your inventory for some reason