Custom Inventories

Discussion in 'Plugin Development' started by ludo0777, Aug 26, 2012.

Thread Status:
Not open for further replies.
  1. I know you can create an inventory using Bukkit.createInventory(); which players can put items in for example in waste disposal plugins, but what I want to know is, can you check what has been put into that inventory and how?
     
  2. InventoryClickEvent would do... however, it would require alot of checking to detect if an item was placed or not.
    I'm unsure if there's a better way tough.
     
  3. Hmm but how would I know its the right inventory that the event is happening in?
     
  4. Offline

    Darq

    Well, there's a couple ways.
    You could 1: Give the inventory a custom name (Bukkit.createInventory() has a parameter for that), and on InventoryCloseEvent, use can call getInventory().getTitle().equals("Inventory Title")

    Or, when opening the inventory: add the player to a HashSet, and check if they're in it on events that would close an inventory. Even doing it this way however, it's a good idea to give your inventory a custom name, and compare it to the inventory that's closing.
     
Thread Status:
Not open for further replies.

Share This Page