Fire ConnectionEstablishedEvent before reading handshake

This commit is contained in:
LOOHP 2024-12-12 20:11:43 +00:00
parent a43aa18a22
commit 01dd765bd2
2 changed files with 4 additions and 3 deletions

View File

@ -24,7 +24,7 @@ import com.loohp.limbo.network.ClientConnection;
public class ConnectionEstablishedEvent extends Event {
private ClientConnection connection;
private final ClientConnection connection;
public ConnectionEstablishedEvent(ClientConnection connection) {
this.connection = connection;

View File

@ -320,6 +320,9 @@ public class ClientConnection extends Thread {
try {
clientSocket.setKeepAlive(true);
setChannel(new DataInputStream(clientSocket.getInputStream()), new DataOutputStream(clientSocket.getOutputStream()));
Limbo.getInstance().getEventsManager().callEvent(new ConnectionEstablishedEvent(this));
int handShakeSize = DataTypeIO.readVarInt(channel.input);
//legacy ping
@ -342,8 +345,6 @@ public class ClientConnection extends Thread {
state = ClientState.DISCONNECTED;
}
Limbo.getInstance().getEventsManager().callEvent(new ConnectionEstablishedEvent(this));
PacketHandshakingIn handshake = (PacketHandshakingIn) channel.readPacket(handShakeSize);
boolean isBungeecord = Limbo.getInstance().getServerProperties().isBungeecord();