Re-open a created inventory

Discussion in 'Plugin Development' started by Liam Allan, Feb 26, 2013.

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

    Liam Allan

    So, lets say I create an inventory (Bukkit.createinventory) with 9 slots as a bank chest when I do "/newbank".

    How would I re-open it if I try "/openbank".

    I can't seem to figure it out and had some trouble finding answers.
    Thanks in advanced.
     
  2. Offline

    Tirelessly

    Save it as a variable. createInventory returns an inventory object.
     
  3. Offline

    Liam Allan

    I understand how to open it on the same command, store .createInventory as an Inventory variable, then player.openInventory.

    I mean open the inventory on a different command.
     
  4. Offline

    Tirelessly

    Save it as a global variable then pass it as the argument to wherever you're using it.
     
  5. Offline

    Liam Allan

    Would that not cause problems for multiple players?
     
  6. Offline

    Technius

    Map player names to inventories using a HashMap.
     
  7. Offline

    McAvarice

    Can if wanna save the items in the inventory. then when it opens place the items in.
    (Would post my code but its all messed up with lore saving etc. Soo its hard to understand)
     
Thread Status:
Not open for further replies.

Share This Page