String var = plugin.getConfig().getString("questNPCNames.1NPC.name"); ConfigurationSection section = plugin.getConfig().getConfigurationSection("quests." + var); // gets the first npc name section.getKeys(false).forEach(key -> { // gets the npc's assigned quests ConfigurationSection section1 = plugin.getConfig().getConfigurationSection("quests." + (var + ".") + (key + ".") + "info."); // get's the quests needed supplies if (p.hasPermission(plugin.getConfig().getString("quests." + (var + ".") + (key + ".") + "permission"))) { new BukkitRunnable() { @Override public void run() { new BukkitRunnable() { @Override public void run() { plugin.questData.setQuestActive(p.getUniqueId(), true); plugin.questData.setQuestNPCName(p.getUniqueId(), e.getView().getTitle()); plugin.questData.setQuestName(p.getUniqueId(), e.getCurrentItem().getItemMeta().getDisplayName()); plugin.questData.setQuestName(p.getUniqueId(), e.getCurrentItem().getItemMeta().getDisplayName()); Bukkit.broadcastMessage(e.getView().getTitle()); return; } }.runTaskLater(plugin, 1); } }.runTask(plugin);