Pages: Messages

Messages

Colors

You can easily translate color codes by adding .translate() to a string. It supports & color codes, &#RRGGBB hex color codes, and MiniMessage tags.

There are also a few pre-made color methods you can use such as .blue(), .white(), .red(), .green(), .gold(), and more.

Legacy text to MiniMessage

Text that comes from other plugins - LuckPerms prefixes, nicknames, config values - is often written with & color codes (including &#RRGGBB hex). If you drop that straight into a .mm() string, the codes show up as literal text. Convert it first with .legacyToMiniMessage():

val prefix = luckPermsPrefix.legacyToMiniMessage()   // "&c[Admin] " -> "<red>[Admin] "
player.sendMessage("$prefix<white>${player.name}".mm())

Message utility

There are many utility methods for sending messages.

You can call the Message class to access them. Some methods are not shown directly because they are extensions of the Player class.

If you want your success and error messages to start with your plugin name, call Message.init(true) once when your plugin starts.

  • sendBossBar – Send a simple bossbar:

    player.sendBossBar(text, progress)
    

    This shows a blue bossbar. If you want more control (color, style, permissions, auto expiry), check out Boss bars.

  • endTimedBossBar – Send a bossbar that fills up and disappears on its own:

    player.endTimedBossBar(plugin, title, progress, duration)
    
  • sendSuccessMessage – Send a success message with sound:

    player.sendSuccessMessage("Success!")
    // Plays ENTITY_EXPERIENCE_ORB_PICKUP
    
  • sendErrorMessage – Send an error message with sound:

    player.sendErrorMessage("Error!")
    // Plays ENTITY_VILLAGER_NO
    

For actionbars, either use Paper's own player.sendActionBar(message), or use the Action bar helper below if you want to show more than one message at once without them overwriting each other.