From e4ba661beedc28bed77c908be6f341ea79ad8c02 Mon Sep 17 00:00:00 2001 From: The Judge <53906078+thejudge156@users.noreply.github.com> Date: Tue, 4 Jun 2024 20:35:31 -0700 Subject: [PATCH] Cries in java 11 --- src/main/java/pojlib/account/LoginHelper.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/pojlib/account/LoginHelper.java b/src/main/java/pojlib/account/LoginHelper.java index a41ede37..9123fd2b 100644 --- a/src/main/java/pojlib/account/LoginHelper.java +++ b/src/main/java/pojlib/account/LoginHelper.java @@ -16,6 +16,7 @@ import java.io.FileReader; import java.io.IOException; import java.net.MalformedURLException; +import java.util.HashSet; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; @@ -64,7 +65,10 @@ public static MinecraftAccount getNewToken(Activity activity) { throw new RuntimeException("Error!: QuestCraft account not set!"); } IAccount account = accounts.iterator().next(); - future = pca.acquireTokenSilently(SilentParameters.builder(Set.of("XboxLive.SignIn", "XboxLive.offline_access"), account).build()); + HashSet params = new HashSet<>(); + params.add("XboxLive.SignIn"); + params.add("XboxLive.offline_access"); + future = pca.acquireTokenSilently(SilentParameters.builder(params, account).build()); } catch (MalformedURLException e) { Logger.getInstance().appendToLog(e.toString()); throw new RuntimeException(e); @@ -82,8 +86,11 @@ public static MinecraftAccount getNewToken(Activity activity) { public static void beginLogin(Activity activity) { loginThread = new Thread(() -> { Consumer deviceCodeConsumer = (DeviceCode deviceCode) -> API_V1.msaMessage = deviceCode.message(); + HashSet params = new HashSet<>(); + params.add("XboxLive.SignIn"); + params.add("XboxLive.offline_access"); CompletableFuture future = pca.acquireToken( - DeviceCodeFlowParameters.builder(Set.of("XboxLive.SignIn", "XboxLive.offline_access"), deviceCodeConsumer).build()); + DeviceCodeFlowParameters.builder(params, deviceCodeConsumer).build()); try { IAuthenticationResult res = future.get();