Paper/patches/server/0487-Fix-hex-colors-not-working-in-some-kick-messages.patch
2022-06-09 14:25:16 -07:00

40 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Thu, 27 Aug 2020 16:57:25 -0400
Subject: [PATCH] Fix hex colors not working in some kick messages
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 43759cdf3da0796d7969c6504ac9a6986c0f0518..750fef0f5b908b776a7306e54653eba497b7c50b 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -75,12 +75,12 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
}
// CraftBukkit end
if (packet.getProtocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
- MutableComponent ichatmutablecomponent;
+ Component ichatmutablecomponent; // Paper - Fix hex colors not working in some kick messages
if (packet.getProtocolVersion() < 754) {
- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
+ ichatmutablecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) , true )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
} else {
- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
+ ichatmutablecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) , true )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
}
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index ae93ca7bcc7347ee165cbb0e9fd20aa3da54616c..25d96d74a656765c92e8df0bb8563947f5587f3b 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -111,7 +111,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
// CraftBukkit start
@Deprecated
public void disconnect(String s) {
- this.disconnect(Component.literal(s));
+ this.disconnect(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s, true)[0]); // Paper - Fix hex colors not working in some kick messages
}
// CraftBukkit end