Skip to content

Commit

Permalink
Cries in java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
thejudge156 authored Jun 5, 2024
1 parent 553a85c commit e4ba661
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/pojlib/account/LoginHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> 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);
Expand All @@ -82,8 +86,11 @@ public static MinecraftAccount getNewToken(Activity activity) {
public static void beginLogin(Activity activity) {
loginThread = new Thread(() -> {
Consumer<DeviceCode> deviceCodeConsumer = (DeviceCode deviceCode) -> API_V1.msaMessage = deviceCode.message();
HashSet<String> params = new HashSet<>();
params.add("XboxLive.SignIn");
params.add("XboxLive.offline_access");
CompletableFuture<IAuthenticationResult> future = pca.acquireToken(
DeviceCodeFlowParameters.builder(Set.of("XboxLive.SignIn", "XboxLive.offline_access"), deviceCodeConsumer).build());
DeviceCodeFlowParameters.builder(params, deviceCodeConsumer).build());

try {
IAuthenticationResult res = future.get();
Expand Down

0 comments on commit e4ba661

Please sign in to comment.