(Resolved) DoubleChest Inventory GUI on left click

Discussion in 'Plugin Development' started by FallenFrie d, Jul 15, 2013.

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

    FallenFrie d

    What we were trying to do is, left clicking a enderchest in the Inventory opens a double chest inventory. The chest is not in the hotbar, it is in the Inventory.

    We also tried to put iron door blocks into the player's slots.....didn't work

    Here is the code:
    http://pastie.org/8143095
     
  2. Offline

    autoit4you

    In the player inventory? Or a chest inventory?
     
  3. Offline

    FallenFrie d

    nothing worked, but we are trying to pull up a double chest when left clicking the ender chest icon
     
  4. Offline

    autoit4you

    Is the enderchest in the player inventory or in the inventory of a chest(or similar object)?

    1. You can't cast the InventoryInteractEvent to a Player. You must use event.getWhoClicked() and cast the result of that to a player.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  5. Offline

    FallenFrie d

    it is in the player inventory.
     
  6. Offline

    autoit4you

    Try the InventoryClickEvent

    Code:java
    1. @EventHandler
    2. public void onItemClick(InventoryClickEvent event) {
    3. Player p = (Player)event.getWhoClicked();
    4. if(event.isLeftClick()) {
    5. if(event.getCurrentItem().getType() == Material.ENDER_CHEST) {
    6. //Open inventory
    7. } else {
    8. //Do something else
    9. }
    10. }
    11. }
     
  7. Offline

    FallenFrie d

    got this part to work, thanks for you help!
     
Thread Status:
Not open for further replies.

Share This Page