From e338bb9a02d5a4fa65bcdf2a96c3b6822564bb6a Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:19:44 +0700 Subject: [PATCH] [FIX] Autoupdate mirror link --- .../gravit/launchserver/config/LaunchServerConfig.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index 3e759cc3..bbc7d86f 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -24,6 +24,7 @@ import java.util.*; public final class LaunchServerConfig { + private final static List oldMirrorList = List.of("https://mirror.gravit.pro/5.2.x/", "https://mirror.gravit.pro/5.3.x/", "https://mirror.gravitlauncher.com/5.2.x/", "https://mirror.gravitlauncher.com/5.3.x/"); private transient final Logger logger = LogManager.getLogger(); public String projectName; public String[] mirrors; @@ -166,12 +167,9 @@ public void verify() { boolean updateMirror = Boolean.getBoolean("launchserver.config.disableUpdateMirror"); if (!updateMirror) { for (int i = 0; i < mirrors.length; ++i) { - if ("https://mirror.gravit.pro/5.2.x/".equals(mirrors[i])) { - logger.warn("Replace mirror 'https://mirror.gravit.pro/5.2.x/' to 'https://mirror.gravitlauncher.com/5.3.x/'. If you really need to use original url, use '-Dlaunchserver.config.disableUpdateMirror=true'"); - mirrors[i] = "https://mirror.gravitlauncher.com/5.3.x/"; - } else if ("https://mirror.gravit.pro/5.3.x/".equals(mirrors[i])) { - logger.warn("Replace mirror 'https://mirror.gravit.pro/5.3.x/' to 'https://mirror.gravitlauncher.com/5.3.x/'. If you really need to use original url, use '-Dlaunchserver.config.disableUpdateMirror=true'"); - mirrors[i] = "https://mirror.gravitlauncher.com/5.3.x/"; + if (mirrors[i] != null && oldMirrorList.contains(mirrors[i])) { + logger.warn("Replace mirror '{}' to 'https://mirror.gravitlauncher.com/5.4.x/'. If you really need to use original url, use '-Dlaunchserver.config.disableUpdateMirror=true'", mirrors[i]); + mirrors[i] = "https://mirror.gravitlauncher.com/5.4.x/"; } } }