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
This commit is contained in:
md_5 2020-06-30 13:12:26 +10:00
parent d47c47ee59
commit 7560f5f5a6
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

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