Skip to content

Commit 723840c

Browse files
committed
More clear message when logging in without a paid Java account
1 parent c28522a commit 723840c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/src/main/java/org/geysermc/geyser/session/GeyserSession.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import lombok.Setter;
4141
import lombok.experimental.Accessors;
4242
import net.kyori.adventure.key.Key;
43+
import net.raphimc.minecraftauth.responsehandler.exception.MinecraftRequestException;
4344
import net.raphimc.minecraftauth.step.java.StepMCProfile;
4445
import net.raphimc.minecraftauth.step.java.StepMCToken;
4546
import net.raphimc.minecraftauth.step.java.session.StepFullJavaSession;
@@ -231,6 +232,7 @@
231232
import java.util.Set;
232233
import java.util.UUID;
233234
import java.util.concurrent.CompletableFuture;
235+
import java.util.concurrent.CompletionException;
234236
import java.util.concurrent.ConcurrentLinkedQueue;
235237
import java.util.concurrent.ScheduledFuture;
236238
import java.util.concurrent.TimeUnit;
@@ -877,7 +879,14 @@ public boolean onMicrosoftLoginComplete(PendingMicrosoftAuthentication.Authentic
877879
return task.getAuthentication().handle((result, ex) -> {
878880
if (ex != null) {
879881
geyser.getLogger().error("Failed to log in with Microsoft code!", ex);
880-
disconnect(ex.toString());
882+
if (ex instanceof CompletionException ce
883+
&& ce.getCause() instanceof MinecraftRequestException mre
884+
&& mre.getResponse().getStatusCode() == 404) {
885+
// Player is trying to join with a Microsoft account that doesn't have Java Edition purchased
886+
disconnect(GeyserLocale.getPlayerLocaleString("geyser.network.remote.invalid_account", locale()));
887+
} else {
888+
disconnect(ex.toString());
889+
}
881890
return false;
882891
}
883892

0 commit comments

Comments
 (0)