3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 14:50:08 +01:00

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
Dieser Commit ist enthalten in:
md_5 2020-06-30 13:12:26 +10:00
Ursprung d47c47ee59
Commit 7560f5f5a6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: E8E901AC7C617C11

Datei anzeigen

@ -1,23 +1,21 @@
--- a/net/minecraft/server/PacketStatusListener.java --- a/net/minecraft/server/PacketStatusListener.java
+++ b/net/minecraft/server/PacketStatusListener.java +++ b/net/minecraft/server/PacketStatusListener.java
@@ -1,5 +1,16 @@ @@ -1,5 +1,14 @@
package net.minecraft.server; package net.minecraft.server;
+// CraftBukkit start +// CraftBukkit start
+import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile;
+import io.netty.channel.ChannelFutureListener;
+import java.net.InetSocketAddress; +import java.net.InetSocketAddress;
+import java.util.Iterator; +import java.util.Iterator;
+ +import org.bukkit.craftbukkit.util.CraftChatMessage;
+import org.bukkit.craftbukkit.util.CraftIconCache; +import org.bukkit.craftbukkit.util.CraftIconCache;
+import org.bukkit.entity.Player; +import org.bukkit.entity.Player;
+
+// CraftBukkit end +// CraftBukkit end
+ +
public class PacketStatusListener implements PacketStatusInListener { public class PacketStatusListener implements PacketStatusInListener {
private static final IChatBaseComponent a = new ChatMessage("multiplayer.status.request_handled"); private static final IChatBaseComponent a = new ChatMessage("multiplayer.status.request_handled");
@@ -26,8 +37,96 @@ @@ -26,8 +35,96 @@
this.networkManager.close(PacketStatusListener.a); this.networkManager.close(PacketStatusListener.a);
} else { } else {
this.d = true; this.d = true;
@ -104,7 +102,7 @@
+ +
+ ServerPing ping = new ServerPing(); + ServerPing ping = new ServerPing();
+ ping.setFavicon(event.icon.value); + ping.setFavicon(event.icon.value);
+ ping.setMOTD(new ChatComponentText(event.getMotd())); + ping.setMOTD(CraftChatMessage.fromString(event.getMotd())[0]);
+ ping.setPlayerSample(playerSample); + ping.setPlayerSample(playerSample);
+ int version = SharedConstants.getGameVersion().getProtocolVersion(); + int version = SharedConstants.getGameVersion().getProtocolVersion();
+ ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version)); + ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));