diff --git a/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/ForgeInstaller.java b/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/ForgeInstaller.java index 87b1ab300..6c005b900 100644 --- a/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/ForgeInstaller.java +++ b/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/ForgeInstaller.java @@ -12,7 +12,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; -import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -44,8 +43,6 @@ public class ForgeInstaller { - private static final MethodHandles.Lookup IMPL_LOOKUP = Unsafe.lookup(); - public static List modInstall(Consumer logger) throws Throwable { InputStream stream = ForgeInstaller.class.getModule().getResourceAsStream("/META-INF/installer.json"); InstallInfo installInfo = new Gson().fromJson(new InputStreamReader(stream), InstallInfo.class); @@ -166,7 +163,7 @@ private static CompletableFuture[] installForge(InstallInfo info, Executor }); var serverFuture = minecraftData.thenCompose(data -> reportSupply(pool, logger).apply( new FileDownloader(String.format(data.serverUrl, info.installer.minecraft), - String.format("libraries/net/minecraft/server/%1$s/server-%1$s.jar", info.installer.minecraft), data.serverHash) + String.format("libraries/net/minecraft/server/%1$s/server-%1$s-bundled.jar", info.installer.minecraft), data.serverHash) )); return new CompletableFuture[]{installerFuture, serverFuture}; } diff --git a/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/MavenDownloader.java b/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/MavenDownloader.java index 9a77540d2..9d1f87312 100644 --- a/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/MavenDownloader.java +++ b/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/MavenDownloader.java @@ -5,15 +5,10 @@ import java.util.LinkedList; import java.util.List; import java.util.StringJoiner; -import java.util.function.Function; import java.util.function.Supplier; public class MavenDownloader implements Supplier { - private static final Function FORGE_TO_BMCLAPI = - s -> s.replace("https://files.minecraftforge.net/maven/", "https://download.mcbbs.net/maven/") - .replace("https://maven.minecraftforge.net/", "https://download.mcbbs.net/maven/"); - private final LinkedList urls; private final String coord; private final String target; @@ -33,8 +28,11 @@ public MavenDownloader(String[] repos, String coord, String target, String hash) public MavenDownloader(String[] repos, String coord, String target, String hash, String sourceUrl) { this(repos, coord, target, hash); if (sourceUrl != null && !this.urls.contains(sourceUrl)) { - this.urls.addFirst(sourceUrl); - this.urls.addFirst(FORGE_TO_BMCLAPI.apply(sourceUrl)); + if (Mirrors.isMirrorUrl(sourceUrl)) { + this.urls.addFirst(sourceUrl); + } else { + this.urls.addLast(sourceUrl); + } } } diff --git a/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/Mirrors.java b/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/Mirrors.java index a0fee64c5..d33198828 100644 --- a/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/Mirrors.java +++ b/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/Mirrors.java @@ -9,13 +9,11 @@ public class Mirrors { private static final String[] MAVEN_REPO = { "https://arclight.hypertention.cn/", - "https://download.mcbbs.net/maven/", "https://repo.spongepowered.org/maven/" }; private static final String[] MOJANG_MIRROR = { - "https://download.mcbbs.net", - "https://bmclapi2.bangbang93.com", + "https://mojmirror.hypertention.cn", "https://piston-meta.mojang.com" }; @@ -39,4 +37,8 @@ public static String mapMojangMirror(String url, String mirror) { .replace("https://piston-meta.mojang.com", mirror) .replace("https://piston-data.mojang.com", mirror); } + + public static boolean isMirrorUrl(String url) { + return url.startsWith(MOJANG_MIRROR[0]); + } }