66import top .syshub .accountsx .core .AccountsX ;
77import top .syshub .accountsx .core .accounts .BaseAccount ;
88import top .syshub .accountsx .core .accounts .model .context .AccountContext ;
9- import top .syshub .accountsx .core .accounts .impl .microsoft .MicrosoftConstants ;
109import top .syshub .accountsx .core .adapters .api .AuthlibAdapter ;
1110
1211import java .io .IOException ;
@@ -18,7 +17,7 @@ public final class AuthlibAdapterImpl implements AuthlibAdapter<AccountSessionIm
1817 public AccountSessionImpl createAccountProfile (BaseAccount .AccountStorage storage , AccountContext context , Proxy proxy ) throws IOException {
1918 YggdrasilAuthenticationService service = new YggdrasilAuthenticationService (proxy , UUID .randomUUID ().toString ());
2019 MinecraftSessionService defaultSessionService = service .createMinecraftSessionService ();
21- MinecraftSessionService sessionService = isCustomSessionServer (context )
20+ MinecraftSessionService sessionService = hasSessionServer (context )
2221 ? new InjectorMinecraftSessionService (context , proxy )
2322 : defaultSessionService ;
2423 if (sessionService instanceof InjectorMinecraftSessionService ) {
@@ -28,17 +27,10 @@ public AccountSessionImpl createAccountProfile(BaseAccount.AccountStorage storag
2827 return new AccountSessionImpl (storage , service , sessionService , profile );
2928 }
3029
31- private static boolean isCustomSessionServer (AccountContext context ) {
30+ private static boolean hasSessionServer (AccountContext context ) {
3231 if (context == null || context .server () == null || context .server ().sessionURL () == null ) {
3332 return false ;
3433 }
35- return !MicrosoftConstants .SESSION .equals (stripTrailingSlash (context .server ().sessionURL ()));
36- }
37-
38- private static String stripTrailingSlash (String url ) {
39- while (url .endsWith ("/" ) && url .length () > 1 ) {
40- url = url .substring (0 , url .length () - 1 );
41- }
42- return url ;
34+ return !context .server ().sessionURL ().trim ().isEmpty ();
4335 }
4436}
0 commit comments