Fix hex colors not working in chat (#6114)

Need to explicitly enable them in our LegacyComponentSerializer.
This commit is contained in:
Josh Roy 2025-03-30 20:02:34 -04:00 committed by GitHub
parent c7ff994d18
commit f3a1b2b495
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,7 @@ public final class AdventureUtil {
final LegacyComponentSerializer.Builder builder = LegacyComponentSerializer.builder()
.flattener(ComponentFlattener.basic())
.extractUrls(AbstractChatEvent.URL_PATTERN)
.hexColors()
.useUnusualXRepeatedCharacterHexFormat();
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01)) {
builder.hexColors();

View File

@ -27,7 +27,9 @@ public abstract class PaperChatListenerProvider implements Listener {
this.serializer = LegacyComponentSerializer.builder()
.flattener(ComponentFlattener.basic())
.extractUrls(AbstractChatEvent.URL_PATTERN)
.useUnusualXRepeatedCharacterHexFormat().build();
.useUnusualXRepeatedCharacterHexFormat()
.hexColors()
.build();
}
public void onChatLowest(final AbstractChatEvent event) {