mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Keep newlines in outdated client/server message (#10042)
This commit is contained in:
parent
c215ce1858
commit
4fdda9e583
3 changed files with 15 additions and 11 deletions
|
@ -5,27 +5,31 @@ 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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
index 21aafb1ea51769659462d722aa318460b37cbc1c..ea4a7186b707e471d5f3972d21502b7a316e0d55 100644
|
index 21aafb1ea51769659462d722aa318460b37cbc1c..5d7f092e966d5b0496f48bd5c9d274157ac6d250 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
@@ -77,12 +77,12 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
@@ -77,14 +77,16 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
||||||
- MutableComponent ichatmutablecomponent;
|
- MutableComponent ichatmutablecomponent;
|
||||||
+ Component ichatmutablecomponent; // Paper - Fix hex colors not working in some kick messages
|
+ 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
|
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
|
- 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() ) )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
|
+ 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 {
|
} else {
|
||||||
- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
|
- 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() ) )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
|
+ 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
|
||||||
|
+
|
||||||
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
|
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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
index 615fb00e50f3c434809f8e1b201d457b9beae8fd..c58fc7d950ea2aa136c3922fb14e4f183f45f2d3 100644
|
index 615fb00e50f3c434809f8e1b201d457b9beae8fd..faf1ae03a308ad07091e3e847370e9bda66288b2 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
@@ -99,7 +99,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
@@ -99,7 +99,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||||
|
@ -33,7 +37,7 @@ index 615fb00e50f3c434809f8e1b201d457b9beae8fd..c58fc7d950ea2aa136c3922fb14e4f18
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void disconnect(String s) {
|
public void disconnect(String s) {
|
||||||
- this.disconnect(Component.literal(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
|
+ 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
|
// CraftBukkit end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ Paper.bypassHostCheck
|
||||||
Seriously, fix your firewalls. -.-
|
Seriously, fix your firewalls. -.-
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
index 2ee5c884571228a353120f658f1a2d39373ea4ca..bb8ba0ba5c70f321d4fd195f14cfb4d75ec0e42f 100644
|
index 5d7f092e966d5b0496f48bd5c9d274157ac6d250..3068e25f2df958689627fb31783a2d356547f1be 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
@@ -30,6 +30,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
@@ -30,6 +30,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||||
|
@ -19,7 +19,7 @@ index 2ee5c884571228a353120f658f1a2d39373ea4ca..bb8ba0ba5c70f321d4fd195f14cfb4d7
|
||||||
|
|
||||||
public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) {
|
public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
@@ -127,7 +128,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
@@ -129,7 +130,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||||
if (!handledByEvent && proxyLogicEnabled) {
|
if (!handledByEvent && proxyLogicEnabled) {
|
||||||
// Paper end
|
// Paper end
|
||||||
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||||
|
|
|
@ -109,7 +109,7 @@ index 598e3ae877f014ce979d8a578445f8a314f0ba82..b7e6c7fdccb91f3cef5e6d96fe5f0c2e
|
||||||
}
|
}
|
||||||
// Spigot End
|
// Spigot End
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
index bb8ba0ba5c70f321d4fd195f14cfb4d75ec0e42f..0b3d6b309ea653d44bcfcd6dd418f692e040c87b 100644
|
index 3068e25f2df958689627fb31783a2d356547f1be..d2edc000f34d7f07a840bb8012c6f884f37e387b 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
@@ -45,6 +45,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
@@ -45,6 +45,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||||
|
@ -128,7 +128,7 @@ index bb8ba0ba5c70f321d4fd195f14cfb4d75ec0e42f..0b3d6b309ea653d44bcfcd6dd418f692
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
|
org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
|
||||||
}
|
}
|
||||||
@@ -129,8 +131,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
@@ -131,8 +133,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||||
// Paper end
|
// Paper end
|
||||||
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||||
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
|
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
|
||||||
|
|
Loading…
Reference in a new issue