Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
homchom committed Oct 27, 2023
1 parent e56c3fd commit d20f1f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/io/github/homchom/recode/ui/ChatUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/io/github/homchom/recode/ui/TextBuilders.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

/**
Expand Down

0 comments on commit d20f1f8

Please sign in to comment.