mirror of https://github.com/LOOHP/Limbo.git
Fire ConnectionEstablishedEvent before reading handshake
This commit is contained in:
parent
a43aa18a22
commit
01dd765bd2
|
|
@ -24,7 +24,7 @@ import com.loohp.limbo.network.ClientConnection;
|
||||||
|
|
||||||
public class ConnectionEstablishedEvent extends Event {
|
public class ConnectionEstablishedEvent extends Event {
|
||||||
|
|
||||||
private ClientConnection connection;
|
private final ClientConnection connection;
|
||||||
|
|
||||||
public ConnectionEstablishedEvent(ClientConnection connection) {
|
public ConnectionEstablishedEvent(ClientConnection connection) {
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,9 @@ public class ClientConnection extends Thread {
|
||||||
try {
|
try {
|
||||||
clientSocket.setKeepAlive(true);
|
clientSocket.setKeepAlive(true);
|
||||||
setChannel(new DataInputStream(clientSocket.getInputStream()), new DataOutputStream(clientSocket.getOutputStream()));
|
setChannel(new DataInputStream(clientSocket.getInputStream()), new DataOutputStream(clientSocket.getOutputStream()));
|
||||||
|
|
||||||
|
Limbo.getInstance().getEventsManager().callEvent(new ConnectionEstablishedEvent(this));
|
||||||
|
|
||||||
int handShakeSize = DataTypeIO.readVarInt(channel.input);
|
int handShakeSize = DataTypeIO.readVarInt(channel.input);
|
||||||
|
|
||||||
//legacy ping
|
//legacy ping
|
||||||
|
|
@ -342,8 +345,6 @@ public class ClientConnection extends Thread {
|
||||||
state = ClientState.DISCONNECTED;
|
state = ClientState.DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
Limbo.getInstance().getEventsManager().callEvent(new ConnectionEstablishedEvent(this));
|
|
||||||
|
|
||||||
PacketHandshakingIn handshake = (PacketHandshakingIn) channel.readPacket(handShakeSize);
|
PacketHandshakingIn handshake = (PacketHandshakingIn) channel.readPacket(handShakeSize);
|
||||||
|
|
||||||
boolean isBungeecord = Limbo.getInstance().getServerProperties().isBungeecord();
|
boolean isBungeecord = Limbo.getInstance().getServerProperties().isBungeecord();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue