diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/Registries.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/Registries.kt index f1bbfaa4..f9d3f28a 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/Registries.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/Registries.kt @@ -101,8 +101,8 @@ object Registries { files: List, noinline keyProvider: (T) -> Pair ): List> { - val adapter = Starbound.gson.getAdapter(T::class.java) - val elementAdapter = Starbound.gson.getAdapter(JsonElement::class.java) + val adapter by lazy { Starbound.gson.getAdapter(T::class.java) } + val elementAdapter by lazy { Starbound.gson.getAdapter(JsonElement::class.java) } return files.map { listedFile -> executor.submit { @@ -174,7 +174,7 @@ object Registries { for ((ext, clazz) in fileMap) { val fileList = files[ext] ?: continue - val adapter = Starbound.gson.getAdapter(clazz) + val adapter by lazy { Starbound.gson.getAdapter(clazz) } for (listedFile in fileList) { tasks.add(executor.submit {