mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 23:17:40 +01:00
f17519338b
* Expose server build information * squash patches * final tweaks --------- Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: masmc05 <masmc05@gmail.com>
44 lines
3.7 KiB
Diff
44 lines
3.7 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 f9314bee1ed9b0e4c4591c0acf8a305721765850..ffe3048d16809b177d2fb495a25a16ed78b50e6b 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
|
@@ -112,14 +112,16 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
|
}
|
|
// CraftBukkit end
|
|
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
|
- MutableComponent ichatmutablecomponent;
|
|
+ net.kyori.adventure.text.Component adventureComponent; // Paper - Fix hex colors not working in some kick messages
|
|
|
|
if (packet.protocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Spigot - SPIGOT-7546: Handle version check correctly for outdated client message
|
|
- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
|
|
+ adventureComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(java.text.MessageFormat.format(org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName())); // 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
|
|
+ adventureComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(java.text.MessageFormat.format(org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName())); // Spigot // Paper - Fix hex colors not working in some kick messages
|
|
}
|
|
|
|
+ Component ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(adventureComponent); // Paper - Fix hex colors not working in some kick messages
|
|
+
|
|
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
|
|
this.connection.disconnect(ichatmutablecomponent);
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
index 5bb7b0ab8a1e566f07f7f39bf072abcbe44e73d2..b968026728b8b4e549eed9fa9b43919c6c19eb7a 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -126,7 +126,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
// CraftBukkit start
|
|
@Deprecated
|
|
public void disconnect(String s) {
|
|
- this.disconnect(Component.literal(s));
|
|
+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s))); // Paper - Fix hex colors not working in some kick messages
|
|
}
|
|
// CraftBukkit end
|
|
|