From 52f1e33052255369852b331fffde30f0dc495f59 Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Mon, 7 Mar 2016 18:41:49 -0500 Subject: [PATCH] I think this fixes the auto update config function when a config file has two similar keys. --- .../com/gmail/nossr50/config/AutoUpdateConfigLoader.java | 7 +++++-- 1 file changed, 5 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 424bf3faf..394964a4f 100644 --- a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java @@ -88,8 +88,11 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader { // Dump to the new one for (String key : comments.keySet()) { - if (output.contains(key)) { - output = output.substring(0, output.indexOf(key)) + comments.get(key) + output.substring(output.indexOf(key)); + if (output.contains(" " + key)) { + output = output.substring(0, output.indexOf(" " + key)) + comments.get(key) + output.substring(output.indexOf(" " + key)); + } + if (output.contains("\n" + key)) { + output = output.substring(0, output.indexOf("\n" + key)) + comments.get(key) + output.substring(output.indexOf("\n" + key)); } } }