Skip to content

Commit

Permalink
Fix not loading authlib-injector server name
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghongxun committed Nov 12, 2019
1 parent 956b4e4 commit 8cdd8b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
12 changes: 0 additions & 12 deletions HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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()));
}
Expand Down
10 changes: 10 additions & 0 deletions HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 8cdd8b3

Please sign in to comment.