Need Help Saving Custom Inventory

Discussion in 'Plugin Development' started by mrbliss, Jun 15, 2014.

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

    mrbliss

    Currently I am having trouble saving my custom inventory created like this

    Code:java
    1. public void OpenInventory(Player p){
    2. Inventory inv = Bukkit.createInventory(p,9 * 1,ChatColor.RED +"Synx EnderChest");
    3. inv.addItem(new ItemStack(iv()));
    4. p.openInventory(inv);
    5. }


    This works while the server is running but when it shuts down or reloads all items are lost. Any help is greatly appreciated
     
  2. Offline

    TheDarkLord197

    Save the inventory to the config.
     
  3. Offline

    mrbliss

  4. Offline

    nzkiwi.5000

    mrbliss you can for example code it to a string array, so the strings will represent item stacks:
    Code:
    <id|dataval>:<quantity>:<customname>:<enchant>
    items: [275:8, 135|2:5:custom name:FIRE_ASPECT]
    or
    items: [NAME:diamond_axe|LORE:cuttin' trees|QUANTITY:5, NAME:dirt|ENCHANT:FORTUNE|ENCHANTLVL:3]
    
    and then parse each string!
    The format? Let your creativity work. :)
    I often use this trick.
     
Thread Status:
Not open for further replies.

Share This Page