diff --git a/src/main/java/dev/xpple/betterconfig/impl/BetterConfigInternals.java b/src/main/java/dev/xpple/betterconfig/impl/BetterConfigInternals.java index a50c793..7b1773b 100644 --- a/src/main/java/dev/xpple/betterconfig/impl/BetterConfigInternals.java +++ b/src/main/java/dev/xpple/betterconfig/impl/BetterConfigInternals.java @@ -47,7 +47,7 @@ public static void init(ModConfigImpl modConfig) { String fieldName = field.getName(); modConfig.getConfigs().put(fieldName, field); try { - modConfig.getDefaults().put(fieldName, field.get(null)); + modConfig.getDefaults().put(fieldName, modConfig.getGson().fromJson(modConfig.getGson().toJsonTree(field.get(null)), field.getGenericType())); } catch (ReflectiveOperationException e) { throw new AssertionError(e); } diff --git a/src/main/java/dev/xpple/betterconfig/impl/ModConfigImpl.java b/src/main/java/dev/xpple/betterconfig/impl/ModConfigImpl.java index 1f7f395..24435b8 100644 --- a/src/main/java/dev/xpple/betterconfig/impl/ModConfigImpl.java +++ b/src/main/java/dev/xpple/betterconfig/impl/ModConfigImpl.java @@ -121,7 +121,7 @@ public void reset(String config) { throw new IllegalArgumentException(); } try { - field.set(null, this.defaults.get(config)); + field.set(null, this.gson.fromJson(this.gson.toJsonTree(this.defaults.get(config)), field.getGenericType())); } catch (ReflectiveOperationException e) { throw new AssertionError(e); }