mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-20 11:22:56 +02:00
49 lines
4.5 KiB
Diff
49 lines
4.5 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 941a9d8addd44e95c467b34f77658592b9f4ef06..ec98a6540a7c4d032234dea5148adaccff7298b9 100644
|
||
|
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||
|
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||
|
@@ -49,7 +49,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||
|
synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
|
||
|
if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
|
||
|
ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);
|
||
|
- MutableComponent chatmessage = Component.literal(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
|
||
|
+ Component chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage, true)[0]; // Paper - Configurable connection throttle kick message // Paper - Fix hex colors not working in some kick messages
|
||
|
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||
|
this.connection.disconnect(chatmessage);
|
||
|
return;
|
||
|
@@ -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 9cefee82f6bd89b825b3007c3306a5f3622a1e70..8da6770f88ce693251812f3c0a803a09286e56ad 100644
|
||
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||
|
@@ -112,7 +112,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
|
||
|
|