Fixed comments never being visible

This commit is contained in:
Andrew 2013-11-06 06:05:10 +13:00
parent adcca1558b
commit acd2da49f8

View File

@ -65,20 +65,24 @@ public class LibsDisguises extends JavaPlugin {
} }
saveDefaultConfig(); saveDefaultConfig();
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml")); FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));
boolean modified = false;
try { try {
for (String option : YamlConfiguration for (String option : YamlConfiguration
.loadConfiguration(this.getClassLoader().getResource("config.yml").openStream()).getKeys(false)) { .loadConfiguration(this.getClassLoader().getResource("config.yml").openStream()).getKeys(false)) {
if (!config.contains(option)) { if (!config.contains(option)) {
config.set(option, getConfig().get(option)); config.set(option, getConfig().get(option));
modified = true;
} }
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
try { if (modified) {
config.save(new File(getDataFolder(), "config.yml")); try {
} catch (IOException e) { config.save(new File(getDataFolder(), "config.yml"));
e.printStackTrace(); } catch (IOException e) {
e.printStackTrace();
}
} }
PacketsManager.init(this); PacketsManager.init(this);
DisguiseAPI.setSoundsEnabled(getConfig().getBoolean("DisguiseSounds")); DisguiseAPI.setSoundsEnabled(getConfig().getBoolean("DisguiseSounds"));