From 2e2abcd645af7809a5b375494c0f78eabf0493f7 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 2 Oct 2013 10:42:06 +0200 Subject: [PATCH] Handle this nicer --- .../java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java index 3d090b494..7b3ebef1a 100644 --- a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java @@ -63,7 +63,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader { output = output.replace(" ", " "); // Rip out Bukkit's attempt to save comments at the top of the file - while (!output.startsWith("General:")) { + while (output.replaceAll("[//s]", "").startsWith("#")) { output = output.substring(output.indexOf('\n', output.indexOf('#')) + 1); } @@ -90,7 +90,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader { // Dump to the new one for (String key : comments.keySet()) { - if (output.indexOf(key) != -1) { + if (output.contains(key)) { output = output.substring(0, output.indexOf(key)) + comments.get(key) + output.substring(output.indexOf(key)); } }