@@ -2,6 +2,7 @@ package com.lambda.config
22
33import com.google.gson.JsonElement
44import com.google.gson.JsonObject
5+ import com.google.gson.reflect.TypeToken
56import com.lambda.Lambda
67import com.lambda.Lambda.LOG
78import com.lambda.config.settings.CharSetting
@@ -21,6 +22,7 @@ import com.lambda.util.Nameable
2122import net.minecraft.block.Block
2223import net.minecraft.util.math.BlockPos
2324import java.awt.Color
25+ import java.lang.reflect.Type
2426
2527/* *
2628 * Represents a set of [AbstractSetting]s that are associated with the [name] of the [Configurable].
@@ -165,7 +167,7 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
165167 defaultValue : List <T >,
166168 description : String = "",
167169 noinline visibility : () -> Boolean = { true },
168- ) = ListSetting (name, defaultValue, description, visibility).also {
170+ ) = ListSetting (name, defaultValue, object : TypeToken < List < T >>() {}.type, description, visibility).also {
169171 settings.add(it)
170172 }
171173
@@ -191,7 +193,7 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
191193 defaultValue : Map <K , V >,
192194 description : String = "",
193195 noinline visibility : () -> Boolean = { true },
194- ) = MapSetting (name, defaultValue, description, visibility).also {
196+ ) = MapSetting (name, defaultValue, object : TypeToken < Map < K , V >>() {}.type, description, visibility).also {
195197 settings.add(it)
196198 }
197199
@@ -217,7 +219,7 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
217219 defaultValue : Set <T >,
218220 description : String = "",
219221 noinline visibility : () -> Boolean = { true },
220- ) = SetSetting (name, defaultValue, description, visibility).also {
222+ ) = SetSetting (name, defaultValue, object : TypeToken < Set < T >>() {}.type, description, visibility).also {
221223 settings.add(it)
222224 }
223225
0 commit comments