mirror of
https://github.com/GeyserMC/GeyserConnect.git
synced 2025-06-26 14:15:22 +02:00
Fix NPE when user should be disconnected because of an old version
This commit is contained in:
parent
0431470b86
commit
f014ca4ef8
1 changed files with 7 additions and 0 deletions
|
@ -90,13 +90,20 @@ public class PacketHandler implements BedrockPacketHandler {
|
|||
BedrockPacketCodec packetCodec = BedrockProtocol.getBedrockCodec(packet.getProtocolVersion());
|
||||
if (packetCodec == null) {
|
||||
session.setPacketCodec(BedrockProtocol.DEFAULT_BEDROCK_CODEC);
|
||||
|
||||
String message = "disconnectionScreen.internalError.cantConnect";
|
||||
PlayStatusPacket status = new PlayStatusPacket();
|
||||
if (packet.getProtocolVersion() > BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||
status.setStatus(PlayStatusPacket.Status.LOGIN_FAILED_SERVER_OLD);
|
||||
message = "disconnectionScreen.outdatedServer";
|
||||
} else if (packet.getProtocolVersion() < BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||
status.setStatus(PlayStatusPacket.Status.LOGIN_FAILED_CLIENT_OLD);
|
||||
message = "disconnectionScreen.outdatedClient";
|
||||
}
|
||||
session.sendPacket(status);
|
||||
session.disconnect(message);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the session codec
|
||||
|
|
Loading…
Add table
Reference in a new issue