/** * Loads the inventories items. * * @param inventory * @param file * @throws InvalidConfigurationException * @throws IOException * @throws FileNotFoundException */ public void loadInventory(Inventory inventory, File file) throws IOException, InvalidConfigurationException { YamlConfiguration yaml = new AlphaYamlConfiguration(); yaml.load(file); int size = yaml.getInt("size", 6 * 9); ConfigurationSection items = yaml.getConfigurationSection("items"); for (int slot = 0; slot < size; slot++) { if (slot < inventory.getSize()) { if (items.isItemStack(slot + "")) { ItemStack item = items.getItemStack(slot + ""); inventory.setItem(slot, item); } } } }