From a7fcafb245b96a6f496c15f5a4fe39c425d56c55 Mon Sep 17 00:00:00 2001 From: md678685 Date: Sat, 27 Oct 2018 15:00:04 +0100 Subject: [PATCH] Filter out comment lines when loading items.json --- Essentials/src/com/earth2me/essentials/ItemDb.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index 674bf4b6d..862ceec7c 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -20,6 +20,7 @@ import org.bukkit.potion.PotionEffect; import java.util.*; import java.util.logging.Logger; +import java.util.stream.Collectors; import static com.earth2me.essentials.I18n.tl; @@ -57,7 +58,12 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb { private void rebuild() { this.reset(); - this.loadJSON(String.join("\n", file.getLines())); + + String json = file.getLines().stream() + .filter(line -> !line.startsWith("#")) + .collect(Collectors.joining()); + + this.loadJSON(String.join("\n", json)); } private void reset() {