Permalink
Browse files

Added: Boolean value to update config

  • Loading branch information...
1 parent f702c2f commit 03fb40f2cb6d440e505ae6cea32226091779f410 @timbru31 committed May 9, 2012
Showing with 13 additions and 7 deletions.
  1. +13 −7 src/de/xghostkillerx/colorme/ColorMe.java
@@ -143,11 +143,17 @@ public void onEnable() {
log.warning("ColorMe failed to load the localization!");
}
- try {
- updateConfig(playersFile);
- } catch (Exception e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ // Force to update the config (remove emtpy lines)
+ if (config.getBoolean("updateConfig")) {
+ try {
+ updateConfig(playersFile);
+ }
+ catch (Exception e) {
+ log.warning("ColorMe failed to update the config! Please report this!");
+ }
+ finally {
+ config.set("updateConfig", false);
+ }
}
// Refer to ColorMeCommands
@@ -236,8 +242,7 @@ public void updateConfig(File config) throws Exception {
}
}
catch (Exception e) {
- log.warning("An error occurred! :(");
- e.printStackTrace();
+ log.warning("An error occurred while updating the config!");
}
finally {
reader.close();
@@ -269,6 +274,7 @@ private void checkStatsStuff() {
// Loads the config at the start
public void loadConfig() {
config.options().header("For help please refer to http://bit.ly/colormebukkit or http://bit.ly/bukkitdevcolorme");
+ config.addDefault("updateConfig", false);
config.addDefault("costs.color", 5.00);
config.addDefault("costs.prefix", 5.00);
config.addDefault("costs.suffix", 5.00);

0 comments on commit 03fb40f

Please sign in to comment.