message

fun Audience.message(block: ClickableMessage.() -> Unit)

Builds and sends a chat message to this Audience.

Works on any platform whose sender implements Audience (Paper, Velocity, …).


fun Audience.message(text: String, color: TextColor? = null)

Builds and sends a simple text message to this Audience.


fun Audience.message(text: String, block: ClickableText.() -> Unit)

Builds and sends a styled text message to this Audience.


fun Audience.message(component: Component, block: ClickableText.() -> Unit = {})

Builds and sends a component-based message to this Audience.


fun message(init: ClickableMessage.() -> Unit): Component

Builds a new chat message.

The API is designed to be used with declarative style kotlin syntax. Example:

message {
    text("Foo") {
        color(GREEN)
        bold()
        runCommand("/bar")
    }
}

This results in a message displaying "Foo" in bold green font and executing the command "/bar" when the user clicks on it.

Parameters

init

The function to construct the message for declarative style syntax.


fun message(text: String, init: ClickableText.() -> Unit = {}): Component

Convenience method to build a simple single component message. For more flexible messages, use the overloaded version.

Parameters

text

The message text

init

A function to apply text formatting in declarative syntax.


fun message(component: Component, init: ClickableText.() -> Unit = {}): Component

Convenience method to build a simple single component message. For more flexible messages, use the overloaded version.

Parameters

component

The component to use as base

init

A function to apply text formatting in declarative syntax.


fun message(text: String, color: TextColor): Component

Convenience method to build a simple colorized message. For more flexible messages, use the overloaded version.

Parameters

text

The message text.

color

The text color.