Skip to content

Commit ce794ad

Browse files
committed
Fix 5963: 愚人节版本 Minecraft 2.0 的 Legacy Fabric 下载列表为空
1 parent c5f56ad commit ce794ad

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

HMCLCore/src/main/java/org/jackhuang/hmcl/download/legacyfabric/LegacyFabricVersionList.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ public Task<?> refreshAsync() {
5252
lock.writeLock().lock();
5353

5454
try {
55-
for (String gameVersion : gameVersions)
56-
for (String loaderVersion : loaderVersions)
55+
for (String metaGameVersion : gameVersions) {
56+
String gameVersion = normalizeVersion(metaGameVersion);
57+
for (String loaderVersion : loaderVersions) {
5758
versions.put(gameVersion, new LegacyFabricRemoteVersion(gameVersion, loaderVersion,
58-
Collections.singletonList(getLaunchMetaUrl(gameVersion, loaderVersion))));
59+
Collections.singletonList(getLaunchMetaUrl(metaGameVersion, loaderVersion))));
60+
}
61+
}
5962
} finally {
6063
lock.writeLock().unlock();
6164
}
@@ -68,19 +71,13 @@ public Task<?> refreshAsync() {
6871
private List<String> getGameVersions(String metaUrl) throws IOException {
6972
String json = NetworkUtils.doGet(downloadProvider.injectURLWithCandidates(metaUrl));
7073
return JsonUtils.GSON.fromJson(json, listTypeOf(GameVersion.class))
71-
.stream()
72-
.map(GameVersion::getVersion)
73-
.map(LegacyFabricVersionList::normalizeGameVersion)
74-
.collect(Collectors.toList());
74+
.stream().map(GameVersion::getVersion).collect(Collectors.toList());
7575
}
7676

77-
78-
private static String normalizeGameVersion(String gameVersion) {
79-
if (gameVersion.startsWith("2point0_")) {
80-
return "2.0_" + gameVersion.substring("2point0_".length());
81-
}
82-
83-
return gameVersion;
77+
private static String normalizeVersion(String version) {
78+
return version.startsWith("2point0_")
79+
? "2.0_" + version.substring("2point0_".length())
80+
: version;
8481
}
8582

8683
private static String getLaunchMetaUrl(String gameVersion, String loaderVersion) {

0 commit comments

Comments
 (0)