Checking If Inventory Is Opened

Discussion in 'Plugin Development' started by Azrex, May 2, 2015.

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

    Azrex

    How would I check if a player has opened the InventoryGui that I created? The name of the gui is "inv"
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    Timiboy27

    Code:
        @EventHandler
        public void onItemEvent(InventoryClickEvent event) {
            if(event.getInventory().getName() == "YourINV"){
                //...
            }
    }
    That would do it @Azrex;)
     
  4. Offline

    mine-care

    @Timiboy27 no it won't do it, do not compare objects with == and it will only work once clicked not once opened, there is inventory open event :- ) also keep spoonfeeding low because most people will just copy paste the code.
    Cheers
     
  5. Offline

    Azrex

    So how do i do it?
     
Thread Status:
Not open for further replies.

Share This Page