From ecae8b3400eb0095ccfec827a850a0b67380d90d Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 23 May 2014 08:00:10 +1200 Subject: [PATCH] Do sub-sections when saving default config --- src/me/libraryaddict/disguise/LibsDisguises.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/me/libraryaddict/disguise/LibsDisguises.java b/src/me/libraryaddict/disguise/LibsDisguises.java index 44597b57..359a837a 100644 --- a/src/me/libraryaddict/disguise/LibsDisguises.java +++ b/src/me/libraryaddict/disguise/LibsDisguises.java @@ -44,9 +44,16 @@ public class LibsDisguises extends JavaPlugin { InputStream stream = null; try { stream = getClassLoader().getResource("config.yml").openStream(); - for (String option : YamlConfiguration.loadConfiguration(stream).getKeys(false)) { + YamlConfiguration internalConfig = YamlConfiguration.loadConfiguration(stream); + for (String option : internalConfig.getKeys(false)) { if (!config.contains(option)) { - config.set(option, getConfig().get(option)); + if (internalConfig.isConfigurationSection(option)) { + for (String secondOption : internalConfig.getConfigurationSection(option).getKeys(false)) { + config.set(option, getConfig().get(option + "." + secondOption)); + } + } else { + config.set(option, getConfig().get(option)); + } needToSaveConfig = true; } }