Expert setting: savebackconfig

This commit is contained in:
asofold 2012-09-22 00:59:38 +02:00
parent 9b1d2c617a
commit 0a2091ea54
3 changed files with 9 additions and 2 deletions

View File

@ -14,6 +14,9 @@ package fr.neatmonster.nocheatplus.config;
*/ */
public abstract class ConfPaths { public abstract class ConfPaths {
// General:
public static final String SAVEBACKCONFIG = "savebackconfig";
/* /*
* 888 ,e, * 888 ,e,
* 888 e88 88e e88 888 e88 888 " 888 8e e88 888 * 888 e88 88e e88 888 e88 888 " 888 8e e88 888

View File

@ -169,7 +169,7 @@ public class ConfigManager {
globalConfig.load(globalFile); globalConfig.load(globalFile);
// Quick shallow ugly fix: only save back if loading was successful. // Quick shallow ugly fix: only save back if loading was successful.
try { try {
globalConfig.save(globalFile); if (globalConfig.getBoolean(ConfPaths.SAVEBACKCONFIG)) globalConfig.save(globalFile);
} catch (final Exception e) { } catch (final Exception e) {
Bukkit.getLogger().severe("[NoCheatPlus] Could not save back config.yml (see exception below)."); Bukkit.getLogger().severe("[NoCheatPlus] Could not save back config.yml (see exception below).");
e.printStackTrace(); e.printStackTrace();
@ -242,7 +242,7 @@ public class ConfigManager {
worldConfig.load(worldFile); worldConfig.load(worldFile);
worldsMap.put(worldEntry.getKey(), worldConfig); worldsMap.put(worldEntry.getKey(), worldConfig);
try{ try{
worldConfig.save(worldFile); if (worldConfig.getBoolean(ConfPaths.SAVEBACKCONFIG)) worldConfig.save(worldFile);
} catch (final Exception e){ } catch (final Exception e){
Bukkit.getLogger().severe("[NoCheatPlus] Couldn't save back world-specific configuration for " Bukkit.getLogger().severe("[NoCheatPlus] Couldn't save back world-specific configuration for "
+ worldEntry.getKey() + " (see exception below)."); + worldEntry.getKey() + " (see exception below).");

View File

@ -26,6 +26,10 @@ public class DefaultConfig extends ConfigFile {
public DefaultConfig() { public DefaultConfig() {
super(); super();
// General:
set(ConfPaths.SAVEBACKCONFIG, true);
/* /*
* 888 ,e, * 888 ,e,
* 888 e88 88e e88 888 e88 888 " 888 8e e88 888 * 888 e88 88e e88 888 e88 888 " 888 8e e88 888