Checking for Inventory Changes?

Discussion in 'Plugin Development' started by MrZoraman, Aug 15, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    MrZoraman

    I've been looking around for a while now and perhaps theres something I've missed. My initial goal is to see what blocks a user in creative mode is putting into his/her inventory.

    I've tried the InventoryClickEvent, but for some reason it isn't doing anything.
    Code:
    public void playerInventoryEvent(InventoryClickEvent event)
        {
            Bukkit.broadcastMessage("Inventory event triggered.");
        }
    I click everywhere in my inventory and move things in and out of it, even in survival mode and the event doesnt' seem to get triggered. And yes I do have
    Code:
    getServer().getPluginManager().registerEvents(this, this);
    In my onEnable(). Am I using the event wrong? Is there a better way to do this? Any help is appreciated. Thanks!

    -Z
     
  2. Offline

    Chiller

    Change:
    public void playerInventoryEvent(InventoryClickEvent event)
    {
    Bukkit.broadcastMessage("Inventory event triggered.");
    }

    To:
    public void onPlayerInventoryEvent(InventoryClickEvent event)
    {
    Bukkit.broadcastMessage("Inventory event triggered.");
    }
     
  3. Offline

    MrZoraman

    I gave that a try. It didn't make a difference though :s

    Edit: I found the problem! I forgot the @EventHandler! :mad:
     
  4. Offline

    Hollasch


    Remember that the method name does not matter, just add the @EventHandler annotation to trigger the method upon the event being triggered.
     
Thread Status:
Not open for further replies.

Share This Page