Fix for 1.18-pre1 server bundler.

In the bundler its called 1.18 Pre-release 1 not 1.18-pre1, so we just assume there is only ever going to be 1 version per jar.
This commit is contained in:
modmuss50
2021-11-11 18:28:15 +00:00
parent e2b4bc8985
commit 2994c2d488
2 changed files with 11 additions and 7 deletions

View File

@@ -281,8 +281,13 @@ public class MinecraftProviderImpl extends DependencyProvider implements Minecra
}
String jarPath = null;
String[] versions = versionsList.split("\n");
for (String version : versionsList.split("\n")) {
if (versions.length != 1) {
throw new UnsupportedOperationException("Expected only 1 version in META-INF/versions.list, but got %d".formatted(versions.length));
}
for (String version : versions) {
if (version.isBlank()) continue;
String[] split = version.split("\t");
@@ -293,10 +298,9 @@ public class MinecraftProviderImpl extends DependencyProvider implements Minecra
final String id = split[1];
final String path = split[2];
if (minecraftVersion().equals(id)) {
jarPath = path;
break;
}
// Take the first (only) version we find.
jarPath = path;
break;
}
Objects.requireNonNull(jarPath, "Could not find minecraft server jar for " + minecraftVersion());