From fa0fdce9cd2ccf4ef539250c595e1ad6221f9b5b Mon Sep 17 00:00:00 2001 From: zml Date: Fri, 16 Feb 2024 21:34:20 +0100 Subject: [PATCH] fix(text-minimessage): Pass through style on virtual components --- .../minimessage/tag/standard/AbstractColorChangingTag.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/standard/AbstractColorChangingTag.java b/text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/standard/AbstractColorChangingTag.java index 91da16bbd..9bc33f57e 100644 --- a/text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/standard/AbstractColorChangingTag.java +++ b/text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/standard/AbstractColorChangingTag.java @@ -61,7 +61,6 @@ * @since 4.10.0 */ abstract class AbstractColorChangingTag implements Modifying, Examinable { - private static final ComponentFlattener LENGTH_CALCULATOR = ComponentFlattener.builder() .mapper(TextComponent.class, TextComponent::content) .unknownMapper(x -> "_") // every unknown component gets a single colour @@ -104,7 +103,7 @@ public final void postVisit() { public final Component apply(final @NotNull Component current, final int depth) { if (depth == 0) { // capture state into a virtual component, no other logic is needed in normal MM handling - return Component.virtual(Void.class, new TagInfoHolder(this.preserveData(), current)); + return Component.virtual(Void.class, new TagInfoHolder(this.preserveData(), current), current.style()); } if ((this.disableApplyingColorDepth != -1 && depth > this.disableApplyingColorDepth) || current.style().color() != null) {