Prevent config.yml to be rewritten with default values on each server

restart.
This commit is contained in:
Boos 2012-03-05 10:51:03 +01:00
parent 7b618ada25
commit 94bd7f12b1

View File

@ -16,9 +16,23 @@ public class boosConfigManager {
private static File confFile;
static List<String> players = new LinkedList<String>();
@SuppressWarnings("static-access")
public boosConfigManager(boosCoolDown boosCoolDown) {
confFile = new File(boosCoolDown.getDataFolder(), "config.yml");
if (confFile.exists()) {
conf = new YamlConfiguration();
try {
conf.load(confFile);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidConfigurationException e) {
e.printStackTrace();
}
}else{
this.confFile = new File(boosCoolDown.getDataFolder(), "config.yml");
this.conf = new YamlConfiguration();
conf.options().copyDefaults(true);
conf.addDefault("commands.options.cancel_warmup_on_damage", false);
conf.addDefault("commands.options.cancel_warmup_on_move", false);
@ -89,6 +103,7 @@ public class boosConfigManager {
e.printStackTrace();
}
}
}
static void load() {
try {