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); List itemStacks = new ArrayList<>(); itemStacks.add(itemStack); for (ItemStack item1 : itemStacks) { if (item1 != null) { if (item1.equals(itemStack)) { p.getInventory().removeItem(item1); // removes the needed supplies from the player's inventory