From 782235327bb350e31ff32863601b15e22c02d399 Mon Sep 17 00:00:00 2001 From: ayunami2000 Date: Mon, 18 Jul 2022 17:54:29 -0400 Subject: [PATCH] protocolsupport support --- .../src/main/java/net/md_5/bungee/ServerConnector.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/ServerConnector.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/ServerConnector.java index 88f5f15..05d1830 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/ServerConnector.java @@ -74,12 +74,12 @@ public class ServerConnector extends PacketHandler @Override public void connected(final ChannelWrapper channel) throws Exception { this.ch = channel; + channel.write(this.user.getPendingConnection().getHandshake()); final ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Login"); out.writeUTF(this.user.getAddress().getHostString()); out.writeInt(this.user.getAddress().getPort()); channel.write(new PacketFAPluginMessage("BungeeCord", out.toByteArray())); - channel.write(this.user.getPendingConnection().getHandshake()); if (this.user.getPendingConnection().getForgeLogin() == null) { channel.write(PacketConstants.CLIENT_LOGIN); } @@ -92,7 +92,8 @@ public class ServerConnector extends PacketHandler @Override public void handle(final Packet1Login login) throws Exception { - Preconditions.checkState(this.thisState == State.LOGIN, (Object)"Not exepcting LOGIN"); + Preconditions.checkState(this.thisState == State.LOGIN || this.thisState == State.ENCRYPT_REQUEST, (Object)"Not expecting LOGIN/ENCRYPT_REQUEST"); + if (this.thisState == State.ENCRYPT_REQUEST) this.thisState = State.LOGIN; final ServerConnection server = new ServerConnection(this.ch, this.target); final ServerConnectedEvent event = new ServerConnectedEvent(this.user, server); this.bungee.getPluginManager().callEvent(event);