Add support for legacyText
This commit is contained in:
@@ -71,6 +71,23 @@ class LiteralTextBuilder(val internalText: BaseComponent, ) {
|
|||||||
siblingText.addExtra(LiteralTextBuilder(text).apply(builder).build())
|
siblingText.addExtra(LiteralTextBuilder(text).apply(builder).build())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append the given legacy text to the parent. This
|
||||||
|
* allows you to use legacy color codes (e.g. `§c` for red).
|
||||||
|
* It is **not** recommended to use this.
|
||||||
|
*
|
||||||
|
* @param text the text instance
|
||||||
|
* @param builder the builder which can be used to set the style and add child text components
|
||||||
|
*/
|
||||||
|
inline fun legacyText(
|
||||||
|
text: String,
|
||||||
|
builder: LiteralTextBuilder.() -> Unit = { }
|
||||||
|
) {
|
||||||
|
TextComponent.fromLegacyText(text).forEach {
|
||||||
|
siblingText.addExtra(LiteralTextBuilder(it).apply(builder).build())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the text which should be displayed when hovering
|
* Sets the text which should be displayed when hovering
|
||||||
* over the text in the chat.
|
* over the text in the chat.
|
||||||
|
Reference in New Issue
Block a user