@@ -22,6 +22,7 @@ import org.jackhuang.hmcl.download.RemoteVersion;
|
|||||||
import org.jackhuang.hmcl.download.VersionList;
|
import org.jackhuang.hmcl.download.VersionList;
|
||||||
import org.jackhuang.hmcl.task.GetTask;
|
import org.jackhuang.hmcl.task.GetTask;
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
|
import org.jackhuang.hmcl.util.gson.JsonUtils;
|
||||||
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -64,11 +65,13 @@ public final class LiteLoaderBMCLVersionList extends VersionList<LiteLoaderRemot
|
|||||||
NetworkUtils.withQuery(downloadProvider.getApiRoot() + "/liteloader/list", Map.of(
|
NetworkUtils.withQuery(downloadProvider.getApiRoot() + "/liteloader/list", Map.of(
|
||||||
"mcversion", gameVersion
|
"mcversion", gameVersion
|
||||||
)))
|
)))
|
||||||
.thenGetJsonAsync(LiteLoaderBMCLVersion.class)
|
.thenApplyAsync(json -> JsonUtils.fromMaybeMalformedJson(json, LiteLoaderBMCLVersion.class))
|
||||||
.thenAcceptAsync(v -> {
|
.thenAcceptAsync(v -> {
|
||||||
lock.writeLock().lock();
|
lock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
versions.clear();
|
versions.clear();
|
||||||
|
if (v == null)
|
||||||
|
return;
|
||||||
versions.put(gameVersion, new LiteLoaderRemoteVersion(
|
versions.put(gameVersion, new LiteLoaderRemoteVersion(
|
||||||
gameVersion, v.version, RemoteVersion.Type.UNCATEGORIZED,
|
gameVersion, v.version, RemoteVersion.Type.UNCATEGORIZED,
|
||||||
Collections.singletonList(NetworkUtils.withQuery(
|
Collections.singletonList(NetworkUtils.withQuery(
|
||||||
|
|||||||
Reference in New Issue
Block a user