mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
6f4fbe1c89
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 30885166 Update to Minecraft 1.16.4 CraftBukkit Changes: 3af81c71 Update to Minecraft 1.16.4 Spigot Changes: f011ca24 Update to Minecraft 1.16.4 Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
64 lines
5.2 KiB
Diff
64 lines
5.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Josh Roy <10731363+JRoy@users.noreply.github.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/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
|
synchronized (throttleTracker) {
|
|
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
|
throttleTracker.put(address, currentTime);
|
|
- ChatMessage chatmessage = new ChatMessage(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
|
|
+ IChatBaseComponent 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.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
|
this.c.close(chatmessage);
|
|
return;
|
|
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
|
}
|
|
// CraftBukkit end
|
|
if (packethandshakinginsetprotocol.c() != SharedConstants.getGameVersion().getProtocolVersion()) {
|
|
- ChatMessage chatmessage;
|
|
+ IChatBaseComponent chatmessage; // Paper - Fix hex colors not working in some kick messages
|
|
|
|
if (packethandshakinginsetprotocol.c() < 754) {
|
|
- chatmessage = new ChatMessage( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getGameVersion().getName() ) ); // Spigot
|
|
+ chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getGameVersion().getName() ) , true )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
|
|
} else {
|
|
- chatmessage = new ChatMessage( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getGameVersion().getName() ) ); // Spigot
|
|
+ chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getGameVersion().getName() ) , true )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
|
|
}
|
|
|
|
this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
|
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
|
if (event.callEvent()) {
|
|
// If we've failed somehow, let the client know so and go no further.
|
|
if (event.isFailed()) {
|
|
- chatmessage = new ChatMessage(event.getFailMessage());
|
|
+ IChatBaseComponent chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(event.getFailMessage(), true)[0]; // Paper - Fix hex colors not working in some kick messages
|
|
this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
|
this.getNetworkManager().close(chatmessage);
|
|
return;
|
|
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
|
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
|
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
|
|
// CraftBukkit start
|
|
@Deprecated
|
|
public void disconnect(String s) {
|
|
- try {
|
|
- IChatBaseComponent ichatbasecomponent = new ChatComponentText(s);
|
|
- LoginListener.LOGGER.info("Disconnecting {}: {}", this.d(), s);
|
|
- this.networkManager.sendPacket(new PacketLoginOutDisconnect(ichatbasecomponent));
|
|
- this.networkManager.close(ichatbasecomponent);
|
|
- } catch (Exception exception) {
|
|
- LoginListener.LOGGER.error("Error whilst disconnecting player", exception);
|
|
- }
|
|
+ disconnect(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s, true)[0]); // Paper - Fix hex colors not working in some kick messages
|
|
}
|
|
// CraftBukkit end
|
|
|