From e22f45ebefbc2358fa52d25dff60687f802dbfa4 Mon Sep 17 00:00:00 2001 From: firef1a Date: Mon, 3 Jun 2024 00:07:54 -0700 Subject: [PATCH] fixed not saving/loading --- src/main/java/dev/fire/config/Config.java | 12 +++++------- src/main/java/dev/fire/utils/MiniMessageChatTag.java | 4 +++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/fire/config/Config.java b/src/main/java/dev/fire/config/Config.java index fcab83b..b921c4f 100644 --- a/src/main/java/dev/fire/config/Config.java +++ b/src/main/java/dev/fire/config/Config.java @@ -27,7 +27,7 @@ public class Config { public boolean DebugMode = DefaultConfig.DebugMode; public boolean VipEnabled = true; - public Map chatTags = convertToMinimessage(DefaultConfig.oldChatTags); + public Map chatTags = Map.copyOf(convertToMinimessage(DefaultConfig.oldChatTags)); public static Map convertToMinimessage(Map map) { Map new_map = new HashMap(); @@ -52,7 +52,7 @@ public static Map convertToMinimessage(Map copy_chatmap = Map.copyOf(chattaghashmap); - - if (copy_chatmap.size() != DefaultConfig.newChatTags.size()) { - throw new DfrevertException("Invalid Config!"); - } - //instance.chatTags = copy_chatmap; + instance.chatTags = copy_chatmap; // load primitives instance.VipEnabled = object.get("VipEnabled").getAsBoolean(); @@ -98,6 +94,8 @@ public static Config getConfig() { instance.DisableMod = object.get("DisableMod").getAsBoolean(); instance.DebugMode = object.get("DebugMode").getAsBoolean(); + DFrevert.LOGGER.info("Successfully loaded config!"); + } catch (Exception exception) { DFrevert.LOGGER.info("Config didn't load: " + exception); DFrevert.LOGGER.info("Making a new one."); diff --git a/src/main/java/dev/fire/utils/MiniMessageChatTag.java b/src/main/java/dev/fire/utils/MiniMessageChatTag.java index 9fd2422..d5cd6ca 100644 --- a/src/main/java/dev/fire/utils/MiniMessageChatTag.java +++ b/src/main/java/dev/fire/utils/MiniMessageChatTag.java @@ -3,7 +3,9 @@ import com.google.gson.JsonObject; import net.minecraft.text.*; -public class MiniMessageChatTag { +import java.io.Serializable; + +public class MiniMessageChatTag implements Serializable { public String mainvalue; public String leftvalue; public String rightvalue;