From cb9b205a842d466850e6959db1554b9abec80126 Mon Sep 17 00:00:00 2001 From: "James (Jamalam)" Date: Sun, 29 Oct 2023 21:45:56 +0000 Subject: [PATCH] finish 1.0.1 --- .../io/github/jamalam360/jamlib/config/ConfigManager.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/io/github/jamalam360/jamlib/config/ConfigManager.java b/common/src/main/java/io/github/jamalam360/jamlib/config/ConfigManager.java index cb3b4c1..e1b5ad9 100644 --- a/common/src/main/java/io/github/jamalam360/jamlib/config/ConfigManager.java +++ b/common/src/main/java/io/github/jamalam360/jamlib/config/ConfigManager.java @@ -124,10 +124,8 @@ public void save() { */ public void reloadFromDisk() { try { - String json = Files.readString(this.configPath); - System.out.println(json); - System.out.println(JANKSON.load(json)); - this.config = JANKSON.fromJson(json, this.configClass); + JsonObject json = JANKSON.load(Files.readAllLines(this.configPath).stream().reduce((a, b) -> a + "\n" + b).orElse("")); + this.config = JANKSON.fromJsonCarefully(json, this.configClass); } catch (Exception e) { JamLib.LOGGER.error("Failed to read config file at " + configPath, e); JamLib.LOGGER.error("Resetting to defaults; a backup will be written to " + configPath + ".broken");