Update Accounts.java

This commit is contained in:
Tungstend 2024-01-15 20:46:28 +08:00
parent 1314659940
commit c996288a50
1 changed files with 12 additions and 18 deletions

View File

@ -62,7 +62,6 @@ import com.tungsten.fclcore.auth.authlibinjector.AuthlibInjectorDownloadExceptio
import com.tungsten.fclcore.auth.authlibinjector.AuthlibInjectorDownloader; import com.tungsten.fclcore.auth.authlibinjector.AuthlibInjectorDownloader;
import com.tungsten.fclcore.auth.authlibinjector.AuthlibInjectorServer; import com.tungsten.fclcore.auth.authlibinjector.AuthlibInjectorServer;
import com.tungsten.fclcore.auth.authlibinjector.BoundAuthlibInjectorAccountFactory; import com.tungsten.fclcore.auth.authlibinjector.BoundAuthlibInjectorAccountFactory;
import com.tungsten.fclcore.auth.authlibinjector.SimpleAuthlibInjectorArtifactProvider;
import com.tungsten.fclcore.auth.microsoft.MicrosoftAccount; import com.tungsten.fclcore.auth.microsoft.MicrosoftAccount;
import com.tungsten.fclcore.auth.microsoft.MicrosoftAccountFactory; import com.tungsten.fclcore.auth.microsoft.MicrosoftAccountFactory;
import com.tungsten.fclcore.auth.microsoft.MicrosoftService; import com.tungsten.fclcore.auth.microsoft.MicrosoftService;
@ -375,24 +374,19 @@ public final class Accounts {
// ==== authlib-injector ==== // ==== authlib-injector ====
private static AuthlibInjectorArtifactProvider createAuthlibInjectorArtifactProvider() { private static AuthlibInjectorArtifactProvider createAuthlibInjectorArtifactProvider() {
String authlibinjectorLocation = FCLPath.AUTHLIB_INJECTOR_PATH; String authlibinjectorLocation = FCLPath.AUTHLIB_INJECTOR_PATH;
if (!new File(authlibinjectorLocation).exists()) { return new AuthlibInjectorDownloader(
return new AuthlibInjectorDownloader( new File(authlibinjectorLocation).toPath(),
new File(authlibinjectorLocation).toPath(), DownloadProviders::getDownloadProvider) {
DownloadProviders::getDownloadProvider) { @Override
@Override public Optional<AuthlibInjectorArtifactInfo> getArtifactInfoImmediately() {
public Optional<AuthlibInjectorArtifactInfo> getArtifactInfoImmediately() { Optional<AuthlibInjectorArtifactInfo> local = super.getArtifactInfoImmediately();
Optional<AuthlibInjectorArtifactInfo> local = super.getArtifactInfoImmediately(); if (local.isPresent()) {
if (local.isPresent()) { return local;
return local;
}
// search authlib-injector.jar in current directory, it's used as a fallback
return parseArtifact(Paths.get("authlib-injector.jar"));
} }
}; // search authlib-injector.jar in current directory, it's used as a fallback
} else { return parseArtifact(Paths.get("authlib-injector.jar"));
LOG.info("Using specified authlib-injector: " + authlibinjectorLocation); }
return new SimpleAuthlibInjectorArtifactProvider(Paths.get(authlibinjectorLocation)); };
}
} }
private static AuthlibInjectorServer getOrCreateAuthlibInjectorServer(String url) { private static AuthlibInjectorServer getOrCreateAuthlibInjectorServer(String url) {