InitialHandler PROCESSING_USERNAME State

This commit is contained in:
LinsaFTW 2022-02-25 19:32:55 -03:00
parent e422dfc79e
commit 1ac9a3b103

View File

@ -1,11 +1,11 @@
From 3534b38cccbcdd2838d7c994f51cfcf3977f0937 Mon Sep 17 00:00:00 2001
From cf468c96ce1390300c7ec73f3bf3a78df012cd10 Mon Sep 17 00:00:00 2001
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
Date: Fri, 25 Feb 2022 12:28:31 -0300
Subject: [PATCH] InitialHandler Processing State
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 4295fd68..5296a5ae 100644
index 4295fd68..26a3dd25 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -128,7 +128,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@ -13,7 +13,7 @@ index 4295fd68..5296a5ae 100644
{
- HANDSHAKE, STATUS, PING, USERNAME, ENCRYPT, FINISHING;
+ PROCESSING, HANDSHAKE, STATUS, PING, USERNAME, ENCRYPT, FINISHING;
+ PROCESSING, PROCESSING_USERNAME, HANDSHAKE, STATUS, PING, USERNAME, ENCRYPT, FINISHING;
}
private boolean canSendKickMessage()
@ -37,7 +37,7 @@ index 4295fd68..5296a5ae 100644
public void handle(Handshake handshake) throws Exception
{
Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" );
+ thisState = State.PROCESSING;
+ thisState = State.PROCESSING_USERNAME;
this.handshake = handshake;
ch.setVersion( handshake.getProtocolVersion() );
@ -57,6 +57,23 @@ index 4295fd68..5296a5ae 100644
SecretKey sharedKey = EncryptionUtil.getSecret( encryptResponse, request );
// Waterfall start
@@ -705,14 +710,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@Override
public void setOnlineMode(boolean onlineMode)
{
- Preconditions.checkState( thisState == State.USERNAME, "Can only set online mode status whilst state is username" );
+ Preconditions.checkState( thisState == State.USERNAME || thisState == State.PROCESSING_USERNAME, "Can only set online mode status whilst state is username" );
this.onlineMode = onlineMode;
}
@Override
public void setUniqueId(UUID uuid)
{
- Preconditions.checkState( thisState == State.USERNAME, "Can only set uuid while state is username" );
+ Preconditions.checkState( thisState == State.USERNAME || thisState == State.PROCESSING_USERNAME, "Can only set uuid while state is username" );
// FlameCord - Allow custom uuids even if onlineMode is true
this.uniqueId = uuid;
}
--
2.32.0