mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Fix hex colors not working in some kick messages
This commit is contained in:
parent
5d139ca424
commit
88335d97a8
2 changed files with 8 additions and 5 deletions
|
@ -31,7 +31,7 @@
|
||||||
switch (packet.intention()) {
|
switch (packet.intention()) {
|
||||||
case LOGIN:
|
case LOGIN:
|
||||||
this.beginLogin(packet, false);
|
this.beginLogin(packet, false);
|
||||||
@@ -55,23 +70,120 @@
|
@@ -55,23 +70,122 @@
|
||||||
throw new UnsupportedOperationException("Invalid intention " + String.valueOf(packet.intention()));
|
throw new UnsupportedOperationException("Invalid intention " + String.valueOf(packet.intention()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,17 +78,20 @@
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
||||||
MutableComponent ichatmutablecomponent;
|
- MutableComponent ichatmutablecomponent;
|
||||||
|
+ net.kyori.adventure.text.Component adventureComponent; // Paper - Fix hex colors not working in some kick messages
|
||||||
|
|
||||||
- if (packet.protocolVersion() < 754) {
|
- if (packet.protocolVersion() < 754) {
|
||||||
- ichatmutablecomponent = Component.translatable("multiplayer.disconnect.outdated_client", SharedConstants.getCurrentVersion().getName());
|
- ichatmutablecomponent = Component.translatable("multiplayer.disconnect.outdated_client", SharedConstants.getCurrentVersion().getName());
|
||||||
+ 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
|
+ 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.translatable("multiplayer.disconnect.incompatible", SharedConstants.getCurrentVersion().getName());
|
- ichatmutablecomponent = Component.translatable("multiplayer.disconnect.incompatible", SharedConstants.getCurrentVersion().getName());
|
||||||
+ 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.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
|
||||||
this.connection.disconnect((Component) ichatmutablecomponent);
|
this.connection.disconnect((Component) ichatmutablecomponent);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ @Deprecated
|
+ @Deprecated
|
||||||
+ public void disconnect(String s) {
|
+ 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
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
|
|
Loading…
Reference in a new issue