Fix: protocol being null during online mode login (#4369)

* fix: protocol being null during online mode login

* gimme more space

* add debug logging for too early downstream packet sending
This commit is contained in:
chris 2023-12-31 02:24:44 +01:00 committed by GitHub
parent 592a58a0c8
commit 46bde0c019
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1633,6 +1633,15 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
* @param intendedState the state the client should be in
*/
public void sendDownstreamPacket(Packet packet, ProtocolState intendedState) {
// protocol can be null when we're not yet logged in (online auth)
if (protocol == null) {
if (geyser.getConfig().isDebugMode()) {
geyser.getLogger().debug("Tried to send downstream packet with no downstream session!");
Thread.dumpStack();
}
return;
}
if (protocol.getState() != intendedState) {
geyser.getLogger().debug("Tried to send " + packet.getClass().getSimpleName() + " packet while not in " + intendedState.name() + " state");
return;