From 7560f5f5a69fc5fa17ec0c33eaba8abe026a53ef Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 30 Jun 2020 13:12:26 +1000 Subject: [PATCH] SPIGOT-5905: Fix hex colours not being allowed in MOTD Note: this will of course not work properly if a pre 1.16 client attempts to ping your server --- nms-patches/PacketStatusListener.patch | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nms-patches/PacketStatusListener.patch b/nms-patches/PacketStatusListener.patch index 3d1a3a9e5f..97e1a70d4a 100644 --- a/nms-patches/PacketStatusListener.patch +++ b/nms-patches/PacketStatusListener.patch @@ -1,23 +1,21 @@ --- a/net/minecraft/server/PacketStatusListener.java +++ b/net/minecraft/server/PacketStatusListener.java -@@ -1,5 +1,16 @@ +@@ -1,5 +1,14 @@ package net.minecraft.server; +// CraftBukkit start +import com.mojang.authlib.GameProfile; -+import io.netty.channel.ChannelFutureListener; +import java.net.InetSocketAddress; +import java.util.Iterator; -+ ++import org.bukkit.craftbukkit.util.CraftChatMessage; +import org.bukkit.craftbukkit.util.CraftIconCache; +import org.bukkit.entity.Player; -+ +// CraftBukkit end + public class PacketStatusListener implements PacketStatusInListener { private static final IChatBaseComponent a = new ChatMessage("multiplayer.status.request_handled"); -@@ -26,8 +37,96 @@ +@@ -26,8 +35,96 @@ this.networkManager.close(PacketStatusListener.a); } else { this.d = true; @@ -104,7 +102,7 @@ + + ServerPing ping = new ServerPing(); + ping.setFavicon(event.icon.value); -+ ping.setMOTD(new ChatComponentText(event.getMotd())); ++ ping.setMOTD(CraftChatMessage.fromString(event.getMotd())[0]); + ping.setPlayerSample(playerSample); + int version = SharedConstants.getGameVersion().getProtocolVersion(); + ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));