Inventory Click Event question

Discussion in 'Plugin Development' started by rmb938, May 20, 2012.

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

    rmb938

    When a player opens a chest how would you go about telling which inventory they clicked in? Their inventory or the chests inventory.
     
  2. Offline

    r0306

    rmb938
    Maybe count the slots of the inventory because players have 10 more slots than chests.

    Code:
    event.getInventory().countSlots();
     
  3. One way would be by the getRawSlot(), the first numbers are always the upper inventory's stuff... you can also getTopInventory() and getBottomInventory() through some other inventory method in the event, but I don't think those can help.

    EDIT: getInventory() gets both inventories together AFAIK.
     
    Adzwoolly likes this.
  4. So you're talking about the InventoryClickEvent, right? Using getRawSlot() will give you the unique slot it and with it you can determine whether it's the players or the chests inventory.

    Edit: got ninja'ed.
     
    Adzwoolly likes this.
  5. Offline

    rmb938

    Yes the Inventory click event. and how are you able to use the raw slot? Just seems like a random number to me.

    Edit: Actually nvm figured it out with raw slot :p
     
  6. No. 0 till event.getView().getTopInventory().size() is the top chest/furnace/etc and from then it's the players inventory.
     
Thread Status:
Not open for further replies.

Share This Page