From 97d0234b2fac6b0c42f4fea3ded6bed62374b18a Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Sat, 5 Mar 2022 15:20:52 -0500 Subject: [PATCH] Fix handling message in PlayerHandshakeEvent (#7542) --- ...andshake-event-to-allow-plugins-to-handle-clien.patch | 6 +++--- ...ix-hex-colors-not-working-in-some-kick-messages.patch | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/patches/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch index fb55e5d5c8..062cc2a5a1 100644 --- a/patches/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/patches/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -24,9 +24,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (event.callEvent()) { + // If we've failed somehow, let the client know so and go no further. + if (event.isFailed()) { -+ TranslatableComponent chatmessage = new TranslatableComponent(event.getFailMessage()); -+ this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); -+ this.connection.disconnect(chatmessage); ++ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage()); ++ this.connection.send(new ClientboundLoginDisconnectPacket(component)); ++ this.connection.disconnect(component); + return; + } + diff --git a/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch index 8d9ea9e548..c692c90f35 100644 --- a/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -33,15 +33,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); -@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - if (event.callEvent()) { - // If we've failed somehow, let the client know so and go no further. - if (event.isFailed()) { -- TranslatableComponent chatmessage = new TranslatableComponent(event.getFailMessage()); -+ Component chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(event.getFailMessage(), true)[0]; // Paper - Fix hex colors not working in some kick messages - this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); - this.connection.disconnect(chatmessage); - return; diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java