Interface MessageApi
public interface MessageApi
Formats configured messages and broadcasts Adventure components.
-
Method Summary
Modifier and TypeMethodDescriptionvoidBroadcasts a MiniMessage string to online players.voidbroadcast(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.ComponentchatLine(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.ComponentmessageComponent(String entry, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... placeholders) Resolves a configured message entry into a component.messageString(String entry) Gets the raw configured MiniMessage template without resolving tags.net.kyori.adventure.text.ComponentminiMessage(String input, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... placeholders) Converts MiniMessage text to a component.net.kyori.adventure.text.ComponentplayerText(String input) Parses player-written visual formatting without interactive or data tags.voidsendAdminChat(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 keyplaceholders- named replacement values- Returns:
- resolved component
-
messageString
-
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 inputplaceholders- dynamic MiniMessage tags- Returns:
- message component
-
playerText
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 configuredchat.format, the prefix of the player, and the display name of the player. The prefix includes thePlayerPrefixEventprefixes forPlayerPrefixEvent.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 linemessage- message body, already formatted- Returns:
- the chat line
-
broadcast
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
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 messageprefix- component to render as prefix, commonly used to show rolesmessage- component to broadcast
-