Fix handling message in PlayerHandshakeEvent (#7542)

This commit is contained in:
Owen1212055 2022-03-05 15:20:52 -05:00
parent 60d2bdf4a5
commit 97d0234b2f
2 changed files with 3 additions and 12 deletions

View file

@ -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;
+ }
+

View file

@ -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