From d20f1f855aa24144a84f0ac9db1ef28169887293 Mon Sep 17 00:00:00 2001 From: pomchom Date: Thu, 26 Oct 2023 21:01:51 -0400 Subject: [PATCH] more --- .../homchom/recode/feature/social/MessageStacking.kt | 2 +- src/main/java/io/github/homchom/recode/ui/ChatUI.kt | 6 +++++- src/main/java/io/github/homchom/recode/ui/TextBuilders.kt | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/homchom/recode/feature/social/MessageStacking.kt b/src/main/java/io/github/homchom/recode/feature/social/MessageStacking.kt index 19658e08..9d0a0ea4 100644 --- a/src/main/java/io/github/homchom/recode/feature/social/MessageStacking.kt +++ b/src/main/java/io/github/homchom/recode/feature/social/MessageStacking.kt @@ -19,7 +19,7 @@ private val stackRegex = regex { fun stackedMessageTag(amount: Int) = GuiMessageTag( ColorPalette.AQUA.hex, GuiMessageTag.Icon.CHAT_MODIFIED, - translateText("chat.tag.recode.stacked", style().red(), arrayOf(amount)), + translateText("chat.tag.recode.stacked", style().aqua(), arrayOf(amount)), "$stackTagPrefix$amount" ) diff --git a/src/main/java/io/github/homchom/recode/ui/ChatUI.kt b/src/main/java/io/github/homchom/recode/ui/ChatUI.kt index 17c089e0..3ffc6dd4 100644 --- a/src/main/java/io/github/homchom/recode/ui/ChatUI.kt +++ b/src/main/java/io/github/homchom/recode/ui/ChatUI.kt @@ -24,7 +24,11 @@ operator fun GuiMessageTag.plus(other: GuiMessageTag): GuiMessageTag { if (first.ordinal > second.ordinal) first else second } val newText = combineIfNotNull(text, other.text) { first, second -> - first.copy().append(" ").append(second) + text { + append(first) + literal(" ") + append(second) + } } val newLogTag = combineIfNotNull(logTag, other.logTag) { first, second -> "$first, $second" diff --git a/src/main/java/io/github/homchom/recode/ui/TextBuilders.kt b/src/main/java/io/github/homchom/recode/ui/TextBuilders.kt index 868560ef..c917b82e 100644 --- a/src/main/java/io/github/homchom/recode/ui/TextBuilders.kt +++ b/src/main/java/io/github/homchom/recode/ui/TextBuilders.kt @@ -79,6 +79,13 @@ value class TextBuilder(val result: MutableComponent = Component.empty()) { ) { result.append(text(style, Component.literal(string), builder)) } + + /** + * Appends a pre-existing [component]. + */ + fun append(component: Component) { + result.append(component) + } } /**