From 8cdd8b3f70a0abaf13898c4a8eb0f3388c0b70cd Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Tue, 12 Nov 2019 18:10:09 +0800 Subject: [PATCH] Fix not loading authlib-injector server name --- HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java | 12 ------------ .../java/org/jackhuang/hmcl/setting/Settings.java | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java b/HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java index f6d7a82fa6..8b62df052b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java @@ -20,9 +20,6 @@ import javafx.application.Application; import javafx.application.Platform; import javafx.stage.Stage; -import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer; -import org.jackhuang.hmcl.setting.Accounts; -import org.jackhuang.hmcl.setting.AuthlibInjectorServers; import org.jackhuang.hmcl.setting.ConfigHolder; import org.jackhuang.hmcl.task.Schedulers; import org.jackhuang.hmcl.task.TaskExecutor; @@ -44,7 +41,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; -import static org.jackhuang.hmcl.setting.ConfigHolder.config; import static org.jackhuang.hmcl.ui.FXUtils.runInFX; import static org.jackhuang.hmcl.util.Logging.LOG; import static org.jackhuang.hmcl.util.i18n.I18n.i18n; @@ -58,14 +54,6 @@ public void start(Stage primaryStage) { try { try { ConfigHolder.init(); - AuthlibInjectorServers.init(); - - if (ConfigHolder.isNewlyCreated() && !AuthlibInjectorServers.getConfigInstance().getUrls().isEmpty()) { - config().setPreferredLoginType(Accounts.getLoginType(Accounts.FACTORY_AUTHLIB_INJECTOR)); - AuthlibInjectorServers.getConfigInstance().getUrls().stream() - .map(AuthlibInjectorServer::new) - .forEach(config().getAuthlibInjectorServers()::add); - } } catch (IOException e) { Main.showErrorAndExit(i18n("fatal.config_loading_failure", Paths.get("").toAbsolutePath().normalize())); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java index ba349c553a..0e040c2914 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java @@ -19,6 +19,7 @@ import javafx.beans.binding.Bindings; import org.jackhuang.hmcl.Metadata; +import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer; import org.jackhuang.hmcl.game.HMCLCacheRepository; import org.jackhuang.hmcl.util.CacheRepository; import org.jackhuang.hmcl.util.io.FileUtils; @@ -44,6 +45,15 @@ static void init() { } private Settings() { + AuthlibInjectorServers.init(); + + if (ConfigHolder.isNewlyCreated() && !AuthlibInjectorServers.getConfigInstance().getUrls().isEmpty()) { + config().setPreferredLoginType(Accounts.getLoginType(Accounts.FACTORY_AUTHLIB_INJECTOR)); + AuthlibInjectorServers.getConfigInstance().getUrls().stream() + .map(AuthlibInjectorServer::new) + .forEach(config().getAuthlibInjectorServers()::add); + } + DownloadProviders.init(); ProxyManager.init(); Accounts.init();