mirror of
https://github.com/LordBoos/boosCooldowns.git
synced 2024-11-26 20:48:11 +01:00
Prevent config.yml to be rewritten with default values on each server
restart.
This commit is contained in:
parent
7b618ada25
commit
94bd7f12b1
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user