Hello there, I created a little method for creating/getting an inventory from the config! Spoiler: Getting inventory Code (Text): public Inventory loadinventory(String name, int rows){ Inventory inv = Bukkit.createInventory(null, 9 * rows, ChatColor.GOLD + name); //create inventory with the name given FileConfiguration config = getConfig(); //this has to be your configuration path for(int i = 0; i < 9 * rows; i++){ //for loop so we can loop trough all slots and add items String path = "inventory." + name + "." + i; //this is the path where you get an slot from the config, you can change this to what you want, make sure you add + i and name! if(config.get(path) != null){ //check if the slot is setted in the config Material material = Material.valueOf(config.getString(path + ".type").toUpperCase()); //create a material from the config ItemStack item = new ItemStack(material); //make a itemstack from the material ItemMeta im = item.getItemMeta(); //get the item propperties im.setDisplayName(config.getString(path + ".name")); // set the name of the item item.setItemMeta(im); //save the item meta inv.setItem(i, item); // set the item in the inventory } } return inv; } Spoiler: Set a slot Code (Text): public void setslot(String inventoryname, int slot, ItemStack item){ FileConfiguration config = getConfig(); //this has to be your configuration path String path = "inventory." + inventoryname + "." + slot; //this is the path where you get an slot from the config, you can change this to what you want, make sure you add + i and name! ItemMeta im = item.getItemMeta(); //get the item propperties String name = im.getDisplayName(); //get the item name String material = item.getType().toString(); // getting the material as a string config.set(path + ".type", material); //add the material to the config config.set(path + ".name", name); //add the name to the config saveConfig(); //save the config } I hope you guys can do something with it! Greetings, Bart
In the get inventory method, instead of i < 54; you should do i <= 9 * rows; as you don't know what the size of the inventory will be.