Concept: How would I save specific items?

Discussion in 'Spigot Plugin Help' started by Kozs, Sep 25, 2016.

  1. Say I want to save a chest that I spawned with the a command, when the server shuts down how would I save the Item Meta, Block Meta, the location of where those items where in the Chest. Any help would be appreciated, I got the rest of the plugin down I am just curious on how to save the items in the users 'virtual' chests
     
  2. You can save all of your stored items in the chest using config files as a "save" area.

    Kinda like you would save your inventory.

    Code (Text):
    for(int i = 0;i<36;i++) {
                                if(getConfig().getItemStack(p.getName() + " Inventory " + i) != null) {
                                    ItemStack loading = getConfig().getItemStack(p.getName() + " Inventory " + i);
                                    p.getInventory().setItem(i,loading);
                                    p.getInventory().setBoots(getConfig().getItemStack(p.getName() + " boots"));
                                    p.getInventory().setChestplate(getConfig().getItemStack(p.getName() + " chestplate"));
                                    p.getInventory().setHelmet(getConfig().getItemStack(p.getName() + " helmet"));
                                    p.getInventory().setLeggings(getConfig().getItemStack(p.getName() + " legs"));
                                }
                            }