Interface MessageApi


public interface MessageApi
Formats configured messages and broadcasts Adventure components.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    broadcast(String miniMessage)
    Broadcasts a MiniMessage string to online players.
    void
    broadcast(net.kyori.adventure.text.Component component)
    Broadcasts a component to online players.
    captureActionBroadcast(org.bukkit.command.CommandSender sender)
    Captures recipient policy for an administrative action on the sender's command thread, before starting asynchronous work or scheduling work on another entity or region.
    net.kyori.adventure.text.Component
    chatLine(org.bukkit.entity.Player player, net.kyori.adventure.text.Component message)
    Renders a message as the public chat line of a player.
    net.kyori.adventure.text.Component
    messageComponent(String entry, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... placeholders)
    Resolves a configured message entry into a component.
    Gets the raw configured MiniMessage template without resolving tags.
    net.kyori.adventure.text.Component
    miniMessage(String input, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... placeholders)
    Converts MiniMessage text to a component.
    net.kyori.adventure.text.Component
    Parses player-written visual formatting without interactive or data tags.
    void
    sendAdminChat(String senderName, net.kyori.adventure.text.Component prefix, net.kyori.adventure.text.Component message)
    Send a component message with chosen component prefix to admins
  • Method Details

    • messageComponent

      net.kyori.adventure.text.Component messageComponent(String entry, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... placeholders)
      Resolves a configured message entry into a component.
      Parameters:
      entry - message key
      placeholders - named replacement values
      Returns:
      resolved component
    • messageString

      String messageString(String entry)
      Gets the raw configured MiniMessage template without resolving tags.
      Parameters:
      entry - message key
      Returns:
      raw message template
    • miniMessage

      net.kyori.adventure.text.Component miniMessage(String input, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... placeholders)
      Converts MiniMessage text to a component.
      Parameters:
      input - MiniMessage input
      placeholders - dynamic MiniMessage tags
      Returns:
      message component
    • playerText

      net.kyori.adventure.text.Component playerText(String input)
      Parses player-written visual formatting without interactive or data tags. Legacy formatting is accepted instead of MiniMessage when legacy codes are present. Blocked MiniMessage tags remain literal text.
      Parameters:
      input - player-written text
      Returns:
      the formatted component
    • chatLine

      net.kyori.adventure.text.Component chatLine(org.bukkit.entity.Player player, net.kyori.adventure.text.Component message)
      Renders a message as the public chat line of a player. The line uses the configured chat.format, the prefix of the player, and the display name of the player. The prefix includes the PlayerPrefixEvent prefixes for PlayerPrefixEvent.Target.CHAT. Plex calls that event synchronously from this method. This method does not send the line. Call it on a thread that can read the player, such as the command thread of that player.
      Parameters:
      player - player who is the source of the line
      message - message body, already formatted
      Returns:
      the chat line
    • broadcast

      void broadcast(String miniMessage)
      Broadcasts a MiniMessage string to online players.
      Parameters:
      miniMessage - MiniMessage input to broadcast
    • broadcast

      void broadcast(net.kyori.adventure.text.Component component)
      Broadcasts a component to online players.
      Parameters:
      component - component to broadcast
    • captureActionBroadcast

      ActionBroadcast captureActionBroadcast(org.bukkit.command.CommandSender sender)
      Captures recipient policy for an administrative action on the sender's command thread, before starting asynchronous work or scheduling work on another entity or region. A vanished player's announcements go only to that player, console, and online players the active SuperVanish/PremiumVanish integration allows to see them at capture time. Later joins, disconnects, or visibility changes do not expand or refresh that audience. Non-player senders and nonvanished players retain ordinary public broadcast behavior. Without a supported vanish plugin, announcements are public.
      Parameters:
      sender - player or non-player performing the action
      Returns:
      reusable announcement delivery for this action, not for subsequent invocations
    • sendAdminChat

      void sendAdminChat(String senderName, net.kyori.adventure.text.Component prefix, net.kyori.adventure.text.Component message)
      Send a component message with chosen component prefix to admins
      Parameters:
      senderName - the name of the user who sent the message
      prefix - component to render as prefix, commonly used to show roles
      message - component to broadcast