player.getInventory().getHolder() instanceof <Player inventory>

Discussion in 'Spigot Plugin Development' started by Settler, May 10, 2015.

  1. Hello, can someone tell name of players inventory.
    I know name for chest and doublechest, but what's name of the player inventory?
    I need for
    if (player.getInventory().getHolder() instanceof <Player inventory name>)

    how to test if a player opened inventory. (InventoryOpenEvent not working)
    #1 Settler, May 10, 2015
    Last edited: May 10, 2015
  2. What? Player#getInventory()#getHolder() returns a HumanEntity and not a PlayerInventory and in case of the Player#getInventory()#getHolder it is THE player which inventory you get
  3. Are you wanting to see if the inventory is a PlayerInventory because if so, it's guaranteed because you are directly getting the players inventory. Right now you have a player, getting their inventory, then getting the player again with getHolder().
  4. I want to see if player opened a inventory.
  5. Nope not working :)
    Code (Text):
    @EventHandler(priority... bla bla)
    public void onInventoryOp(InventoryOpenEvent e) {

  6. Oh you want to know when the player opens HIS inventory? that cannot be detected by the server as that is completely handeled clientside. Didn't understood what exactly you mean. had a little brainfart. lol
  7. Is other ever an instance where the player opens a playerinventory that is not his own?
  8. Well. if you /invsee someone via essentials for example :p

    but other than that. No. I honestly just missunderstood the question completely
  9. @L33m4n123 it's possible to see if player is looking at inventory.
    But with repeating task.
  10. Yes, but isn't that just a chest with the same contents?
  11. No Idea. Never looked at how the plugin does it :p And it was just a joke^^ As I said. I didn't understood his question at the beginning