Solved InventoryClickEvent which inventory is the click in?

Discussion in 'Plugin Development' started by TwoPointDuck, Sep 8, 2014.

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

    TwoPointDuck

    Is there an easy way of telling which inventory they are clicking (top or bottom) which I'm missing?
    I mainly wish to know if they are clicking in a different container not armor, crafting, result.

    Thanks for any and all answers :)
     
  2. Offline

    Cerberus XII

  3. Offline

    mine-care

    Hmmm, not sure at all. But I would try checking for if e.getinventory is PlayerInventory so that means. They clicked the down part
     
  4. Offline

    Bartoke

    You can check whether the player's inventory contains the item that was clicked

    Code:java
    1. if(player.getInventory().contains(/* item */)) {
    2. // do stuff
    3. } else {
    4. // do other stuff
    5. }


    but it's not always that accurate and won't tell the difference if you click slots without anything in them
     
  5. Offline

    TwoPointDuck

    It was super simple all along. event.getClickedInventory() == event.getView().getTopInventory()
     
Thread Status:
Not open for further replies.

Share This Page