Force open a player's inventory

Discussion in 'Plugin Development' started by JUSTCAMH, Apr 28, 2015.

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

    JUSTCAMH

    I want to have it that when a player closes a custom inventory (using the PlayerCloseInventoryEvent), their normal player inventory will open instead of the inventory closing. So I can do everything, I just can't figure out how to open a player's inventory. I tried:
    Code:
    p.openInventory(p.getInventory);
    however this open's their inventory space only, similar to a chest. I want it to open a player's normal inventory, the one that opens when you press e.
     
  2. Offline

    teej107

  3. Offline

    nverdier

  4. Offline

    teej107

    Closest thing you got AFAIK. It would do no good to cast to a PlayerInventory because Player#getInventory() already returns one.
     
  5. Offline

    nverdier

    Ah yes, sorry. Didn't check the docs or remember.
     
  6. Offline

    caderape

    @JUSTCAMH
    If the inventory is custom , just get their inventory with a player.openinventory(player.getinventory)

    You might close the first one before or add a lil shceduler. Cuz the event is called before the inventory is closed.
     
  7. Offline

    JUSTCAMH

    @caderape Next time, try reading the original post
    Not trying to be mean
     
  8. Offline

    I Al Istannen

Thread Status:
Not open for further replies.

Share This Page