From 50f6d0f8adcf8aa025c7aa213e2d3e990be55fbf Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:54:34 +0200 Subject: [PATCH 1/2] Cleanup --- .../org/geysermc/mcprotocollib/protocol/ClientListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ClientListener.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ClientListener.java index b6bc81337..b730fdb54 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ClientListener.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ClientListener.java @@ -163,7 +163,7 @@ public void packetReceived(Session session, Packet packet) { public void connected(ConnectedEvent event) { Session session = event.getSession(); MinecraftProtocol protocol = (MinecraftProtocol) session.getPacketProtocol(); - ClientIntentionPacket intention = new ClientIntentionPacket(protocol.getCodec().getProtocolVersion(), event.getSession().getHost(), event.getSession().getPort(), switch (this.targetState) { + ClientIntentionPacket intention = new ClientIntentionPacket(protocol.getCodec().getProtocolVersion(), session.getHost(), session.getPort(), switch (this.targetState) { case LOGIN -> transferring ? HandshakeIntent.TRANSFER : HandshakeIntent.LOGIN; case STATUS -> HandshakeIntent.STATUS; default -> throw new IllegalStateException("Unexpected value: " + this.targetState); From 4a9adfbfc90059f83bb02e3ffe5a8088e68da3f7 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:23:34 +0200 Subject: [PATCH 2/2] Fix component args --- .../org/geysermc/mcprotocollib/protocol/ServerListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ServerListener.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ServerListener.java index 2f0ac6039..71b6f93bd 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ServerListener.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/ServerListener.java @@ -214,9 +214,9 @@ private void beginLogin(Session session, MinecraftProtocol protocol, ClientInten isTransfer = transferred; session.switchOutboundProtocol(() -> protocol.setOutboundState(ProtocolState.LOGIN)); if (packet.getProtocolVersion() > protocol.getCodec().getProtocolVersion()) { - session.disconnect(Component.translatable("multiplayer.disconnect.incompatible", protocol.getCodec().getMinecraftVersion())); + session.disconnect(Component.translatable("multiplayer.disconnect.incompatible", Component.text(protocol.getCodec().getMinecraftVersion()))); } else if (packet.getProtocolVersion() < protocol.getCodec().getProtocolVersion()) { - session.disconnect(Component.translatable("multiplayer.disconnect.outdated_client", protocol.getCodec().getMinecraftVersion())); + session.disconnect(Component.translatable("multiplayer.disconnect.outdated_client", Component.text(protocol.getCodec().getMinecraftVersion()))); } else { session.switchInboundProtocol(() -> protocol.setInboundState(ProtocolState.LOGIN)); }