ChatLib

object ChatLib

Functions

Link copied to clipboard
fun actionBar(text: Any)

Shows text in the action bar. The text can be a String, a Message or a TextComponent

Link copied to clipboard
fun addColor(message: String?): String

Replaces the easier to type '&' color codes with proper color codes in a string.

Link copied to clipboard
fun addToSentMessageHistory(index: Int = -1, message: String)

Adds a message to the player's chat history. This allows the message to show up for the player when pressing the up/down keys while in the chat gui

Link copied to clipboard
fun chat(text: Any)

Prints text in the chat. The text can be a String, a Message or a TextComponent

Link copied to clipboard
fun clearChat(vararg chatLineIDs: Int)

Clear chat messages with the specified message ID, or all chat messages if no ID is specified

Link copied to clipboard
fun command(text: String, clientSide: Boolean = false)

Runs a command.

Link copied to clipboard
fun deleteChat(toDelete: Message)

Deletes an already sent chat message by the Message

fun deleteChat(chatLineId: Int)

Deletes an already sent chat message by its chat line id

fun deleteChat(toDelete: String)

Deletes an already sent chat message by the text of the chat

fun deleteChat(regexp: NativeRegExp)

Deletes an already sent chat message matching regexp.

Link copied to clipboard
fun editChat(toReplace: Message, vararg replacements: Message)

Edits an already sent chat message by the Message

fun editChat(chatLineId: Int, vararg replacements: Message)

Edits an already sent chat message by its chat line id

fun editChat(toReplace: String, vararg replacements: Message)

Edits an already sent chat message by the text of the chat

fun editChat(regexp: NativeRegExp, vararg replacements: Message)

Edits an already sent chat message matched by regexp.

Link copied to clipboard
fun getCenteredText(text: String): String

Get a message that will be perfectly centered in chat.

Link copied to clipboard
fun getChatBreak(separator: String = "-"): String

Get a message that will be perfectly one line of chat, the separator repeated as many times as necessary. The separator defaults to "-"

Link copied to clipboard
fun getChatLines(): List<String>

Gets the previous 1000 lines of chat

Link copied to clipboard
fun getChatMessage(event: ClientChatReceivedEvent, formatted: Boolean = false): String

Get the text of a chat event. Defaults to the unformatted version.

Link copied to clipboard
fun getChatWidth(): Int

Gets the width of Minecraft's chat

Link copied to clipboard
fun isPlayer(out: String): Boolean
Link copied to clipboard
fun removeFormatting(text: String): String

Remove all formatting

Link copied to clipboard
fun replaceFormatting(text: String): String

Replaces Minecraft formatted text with normal formatted text

Link copied to clipboard
fun say(text: String): Unit?

Says chat message. This message is actually sent to the server.

Link copied to clipboard
fun simulateChat(text: Any)

Simulates a chat message to be caught by other triggers for testing. The text can be a String, a Message or a TextComponent

Sources

Link copied to clipboard