Disconnect client if using an invalid Mojang account (#975)

This commit supresses the NPE that was previously sent when using an invalid Mojang account. Instead, the Bedrock client is disconnected with an error message.
This commit is contained in:
Camotoy 2020-07-18 16:56:12 -04:00 committed by GitHub
parent 64d5390800
commit 221e5bd103
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -350,6 +350,11 @@ public class GeyserSession implements CommandSender {
public void connected(ConnectedEvent event) { public void connected(ConnectedEvent event) {
loggingIn = false; loggingIn = false;
loggedIn = true; loggedIn = true;
if (protocol.getProfile() == null) {
// Java account is offline
disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode()));
return;
}
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect", authData.getName(), protocol.getProfile().getName(), remoteServer.getAddress())); connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect", authData.getName(), protocol.getProfile().getName(), remoteServer.getAddress()));
playerEntity.setUuid(protocol.getProfile().getId()); playerEntity.setUuid(protocol.getProfile().getId());
playerEntity.setUsername(protocol.getProfile().getName()); playerEntity.setUsername(protocol.getProfile().getName());