1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-16 18:31:53 +01:00

Enable Hex colors on PaperAdventure.LEGACY_SECTION_UXRC, and use it for sending messages to console command sender ()

This fixes messages to console having colors stripped, and also fixes colors being downsampled in PlayerConnection#disconnect(String)
This commit is contained in:
Jason Penilla 2021-02-22 22:43:49 -08:00
parent 3d23a7351e
commit 36e0569896
2 changed files with 3 additions and 3 deletions

View file

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java
@@ -0,0 +0,0 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co
public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
this.sendRawMessage(net.kyori.adventure.text.serializer.plain.PlainComponentSerializer.plain().serialize(message));
this.sendRawMessage(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(message));
}
+
+ @Override

View file

@ -224,7 +224,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+public final class PaperAdventure {
+ public static final AttributeKey<Locale> LOCALE_ATTRIBUTE = AttributeKey.valueOf("adventure:locale");
+ public static final LegacyComponentSerializer LEGACY_SECTION_UXRC = LegacyComponentSerializer.builder().useUnusualXRepeatedCharacterHexFormat().build();
+ public static final LegacyComponentSerializer LEGACY_SECTION_UXRC = LegacyComponentSerializer.builder().hexColors().useUnusualXRepeatedCharacterHexFormat().build();
+ static final GsonComponentSerializer GSON = GsonComponentSerializer.builder()
+ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE)
+ .build();
@ -1742,7 +1742,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
+ this.sendRawMessage(net.kyori.adventure.text.serializer.plain.PlainComponentSerializer.plain().serialize(message));
+ this.sendRawMessage(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(message));
+ }
+ // Paper end
}