aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/textutil.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-12-31 16:52:29 +0100
committerLinnea Gräf <nea@nea.moe>2024-12-31 16:52:29 +0100
commita892a5f90b87b530331a7652dd4eb5bc07bf1c03 (patch)
tree808ac4b59557b2b0a6c8459a2dac13ce272937a6 /src/main/kotlin/util/textutil.kt
parent533fd68e2be8236c842f53fd0cafa52341226226 (diff)
parent620f1a45ac02b078e95c68a59a45bd4d24ff176b (diff)
downloadFirmament-a892a5f90b87b530331a7652dd4eb5bc07bf1c03.tar.gz
Firmament-a892a5f90b87b530331a7652dd4eb5bc07bf1c03.tar.bz2
Firmament-a892a5f90b87b530331a7652dd4eb5bc07bf1c03.zip
Merge branch 'mc-1.21.3'
Diffstat (limited to 'src/main/kotlin/util/textutil.kt')
-rw-r--r--src/main/kotlin/util/textutil.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/kotlin/util/textutil.kt b/src/main/kotlin/util/textutil.kt
index 5d95d7a..ab3de43 100644
--- a/src/main/kotlin/util/textutil.kt
+++ b/src/main/kotlin/util/textutil.kt
@@ -133,6 +133,7 @@ fun MutableText.darkGreen() = withColor(Formatting.DARK_GREEN)
fun MutableText.purple() = withColor(Formatting.DARK_PURPLE)
fun MutableText.pink() = withColor(Formatting.LIGHT_PURPLE)
fun MutableText.yellow() = withColor(Formatting.YELLOW)
+fun MutableText.gold() = withColor(Formatting.GOLD)
fun MutableText.grey() = withColor(Formatting.GRAY)
fun MutableText.red() = withColor(Formatting.RED)
fun MutableText.white() = withColor(Formatting.WHITE)
@@ -142,11 +143,15 @@ fun MutableText.bold(): MutableText = styled { it.withBold(true) }
fun MutableText.clickCommand(command: String): MutableText {
require(command.startsWith("/"))
return this.styled {
- it.withClickEvent(ClickEvent(ClickEvent.Action.RUN_COMMAND,
- "/firm disablereiwarning"))
+ it.withClickEvent(ClickEvent(ClickEvent.Action.RUN_COMMAND, command))
}
}
+fun MutableText.prepend(text: Text): MutableText {
+ siblings.addFirst(text)
+ return this
+}
+
fun Text.transformEachRecursively(function: (Text) -> Text): Text {
val c = this.content
if (c is TranslatableTextContent) {