Message

A basic formatted Chat Message.

The text can be formatted, but no interactions are allowed. Use ClickableMessage to allow user interaction with the message. Formatting is inherited to all text components but can be overwritten by individual text components. To start building a message use message and declarative style kotlin syntax.

Functions

Link copied to clipboard
open override fun bold(bold: Boolean)

Sets the font to bold.

Link copied to clipboard
open override fun color(color: TextColor)

Sets the color for the component.

Link copied to clipboard
open override fun italic(italic: Boolean)

Sets the font to italic.

Link copied to clipboard
fun legacyText(legacyText: String, init: Text.() -> Unit = {})

Adds a new text component from a legacy message formatted with § and color codes. Useful for things such as player display names.

Link copied to clipboard
fun newLine()

Adds a newline to the message content.

Link copied to clipboard
open override fun obfuscated(obfuscated: Boolean)

Obfuscates text by switching each letter between multiple characters. Will result in non-readable text.

Link copied to clipboard
fun space()

Adds a space to the message content.

Link copied to clipboard
open override fun strikeThrough(strikeThrough: Boolean)

Strikes the text through.

Link copied to clipboard
fun text(text: String, init: Text.() -> Unit = {})
fun text(component: Component, init: Text.() -> Unit = {})

Adds a new text component to the message.

Link copied to clipboard
fun toChatMessage(): Component

Converts the message to a Component to use with the Chat API.

Link copied to clipboard
open override fun underlined(underlined: Boolean)

Underlines the text.