oops
This commit is contained in:
parent
b4940ce8ca
commit
a23493fa83
@ -5,6 +5,9 @@ import com.google.gson.JsonObject
|
|||||||
import com.google.gson.TypeAdapter
|
import com.google.gson.TypeAdapter
|
||||||
import com.google.gson.stream.JsonReader
|
import com.google.gson.stream.JsonReader
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap
|
||||||
|
import kotlinx.coroutines.future.asCompletableFuture
|
||||||
|
import kotlinx.coroutines.future.await
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import ru.dbotthepony.kstarbound.json.FastJsonTreeReader
|
import ru.dbotthepony.kstarbound.json.FastJsonTreeReader
|
||||||
import ru.dbotthepony.kstarbound.json.VersionedJson
|
import ru.dbotthepony.kstarbound.json.VersionedJson
|
||||||
import java.util.concurrent.Future
|
import java.util.concurrent.Future
|
||||||
@ -51,13 +54,13 @@ object VersionRegistry {
|
|||||||
private val adapter by lazy { Starbound.gson.getAdapter(VersionedJson::class.java) }
|
private val adapter by lazy { Starbound.gson.getAdapter(VersionedJson::class.java) }
|
||||||
|
|
||||||
fun load(): Future<*> {
|
fun load(): Future<*> {
|
||||||
return Starbound.EXECUTOR.submit(Runnable {
|
return Starbound.GLOBAL_SCOPE.launch {
|
||||||
val json = Starbound.loadJsonAsset("/versioning.config") ?: throw NoSuchElementException("Unable to load /versioning.config! Expect HUGE problems!")
|
val json = Starbound.loadJsonAsset("/versioning.config").await() ?: throw NoSuchElementException("Unable to load /versioning.config! Expect HUGE problems!")
|
||||||
json as JsonObject
|
json as JsonObject
|
||||||
|
|
||||||
for ((k, v) in json.entrySet()) {
|
for ((k, v) in json.entrySet()) {
|
||||||
versions[k] = v.asInt
|
versions[k] = v.asInt
|
||||||
}
|
}
|
||||||
})
|
}.asCompletableFuture()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user