How do i Save the first 27 Items from an inv to a config? Code: public void saveInv(Player p, Inventory inv){ File file = new File("plugins//" + main.directoryFolderName + "//EnderChests", p.getUniqueId().toString()); FileConfiguration cfg = new YamlConfiguration().loadConfiguration(file); File file1 = new File("plugins//" + main.directoryFolderName + "//EnderChestSlots", p.getUniqueId().toString()); FileConfiguration cfg1 = new YamlConfiguration().loadConfiguration(file1); //THIS DONT WORK BUT WHY? IT SAVES NOTHING THE CONFIG IS EMPTY AFTER THIS for(int in = 0; in < cfg1.getInt("slots"); in++){ ItemStack i = inv.getItem(in); cfg.set("inventory", i); } try { cfg.save(file); } catch (IOException e) { } }
Are you sure slots is not empty? Also I don't see where you're saving the slots so it would be helpful seeing that part of the code.