ConfigurationSection section1 = plugin.getConfig().getConfigurationSection("quests." + (plugin.questData.getQuestNPCName(p.getUniqueId()) + ".") + (plugin.questData.getQuestName(p.getUniqueId()) + ".") + "neededSupplies"); // get's the quests needed supplies section1.getKeys(false).forEach(key -> { // gets all the keys in the needed supplies ConfigurationSection section = plugin.getConfig().getConfigurationSection("quests." + (plugin.questData.getQuestNPCName(p.getUniqueId()) + ".") + (plugin.questData.getQuestName(p.getUniqueId()) + ".") + "neededSupplies." + key); section.getKeys(false).forEach(item -> { Material material = Material.valueOf(plugin.getConfig().getString("quests." + (plugin.questData.getQuestNPCName(p.getUniqueId()) + ".") + (plugin.questData.getQuestName(p.getUniqueId()) + ".") + "neededSupplies." + (key + ".") + "material")); int amount = plugin.getConfig().getInt("quests." + (plugin.questData.getQuestNPCName(p.getUniqueId()) + ".") + (plugin.questData.getQuestName(p.getUniqueId()) + ".") + "neededSupplies." + (key + ".") + "amount"); ItemStack itemStack = new ItemStack(material, amount); for (ItemStack item1 : p.getInventory().getContents()) { if (item1 != null) { if (item1.equals(itemStack)) { p.getInventory().removeItem(item1); // removes the needed supplies from the player's inventory