Interface DMMessageUtils
public interface DMMessageUtils
This class is used to send messages to players. You can for example send prefixed messages with this.
Please use the
DialogueMasterAPI.getMessageUtils()
method to get the message utils.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionnet.kyori.adventure.text.Component
Gets the prefix of the plugin.Gets the prefix string of the plugin without deserialization.net.kyori.adventure.text.Component
Gets the short prefix of the plugin without deserialization.Gets the short prefix string of the plugin without deserialization.void
registerMessage
(@NotNull String messageNode, @NotNull String message) Registers a message in the plugin's messages.yml.void
sendConfigurableMessage
(@NotNull net.kyori.adventure.audience.Audience audience, @NotNull String messageNode, @NotNull List<Pair<String, String>> placeholders) Sends a configurable message to the player.void
sendConfigurableMessage
(@NotNull org.bukkit.command.CommandSender sender, @NotNull String messageNode, @NotNull List<Pair<String, String>> placeholders) Sends a configurable message to the player.void
sendConfigurableMessage
(@NotNull org.bukkit.entity.Player player, @NotNull String messageNode, @NotNull List<Pair<String, String>> placeholders) Sends a configurable message to the player.void
sendPrefixedMessage
(@NotNull net.kyori.adventure.audience.Audience audience, @NotNull String message, boolean isShort) Sends a prefixed message to the player.void
sendPrefixedMessage
(@NotNull net.kyori.adventure.audience.Audience audience, @NotNull String message, boolean isShort, DMMessageUtils.Color color) Sends a prefixed message to the player.void
sendPrefixedMessage
(@NotNull net.kyori.adventure.audience.Audience audience, @NotNull net.kyori.adventure.text.Component message, boolean isShort) Sends a prefixed message to the player.void
sendPrefixedMessage
(@NotNull net.kyori.adventure.audience.Audience audience, @NotNull net.kyori.adventure.text.Component message, boolean isShort, DMMessageUtils.Color color) Sends a prefixed message to the player.void
sendPrefixedMessage
(@NotNull org.bukkit.entity.Player player, @NotNull String message, boolean isShort) Sends a prefixed message to the player.void
sendPrefixedMessage
(@NotNull org.bukkit.entity.Player player, @NotNull String message, boolean isShort, DMMessageUtils.Color color) Sends a prefixed message to the player.void
sendPrefixedMessage
(@NotNull org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.Component message, boolean isShort) Sends a prefixed message to the player.void
sendPrefixedMessage
(@NotNull org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.Component message, boolean isShort, DMMessageUtils.Color color) Sends a prefixed message to the player.
-
Method Details
-
getPrefix
net.kyori.adventure.text.Component getPrefix()Gets the prefix of the plugin.- Returns:
- The prefix of the plugin.
-
getShortPrefix
net.kyori.adventure.text.Component getShortPrefix()Gets the short prefix of the plugin without deserialization.- Returns:
- The short prefix of the plugin.
-
getPrefixString
String getPrefixString()Gets the prefix string of the plugin without deserialization.- Returns:
- The prefix string of the plugin.
-
getShortPrefixString
String getShortPrefixString()Gets the short prefix string of the plugin without deserialization.- Returns:
- The short prefix string of the plugin.
-
sendPrefixedMessage
void sendPrefixedMessage(@NotNull @NotNull net.kyori.adventure.audience.Audience audience, @NotNull @NotNull net.kyori.adventure.text.Component message, boolean isShort, DMMessageUtils.Color color) Sends a prefixed message to the player.- Parameters:
audience
- The audience to send the message to.message
- The message to send.
-
sendPrefixedMessage
void sendPrefixedMessage(@NotNull @NotNull net.kyori.adventure.audience.Audience audience, @NotNull @NotNull String message, boolean isShort, DMMessageUtils.Color color) Sends a prefixed message to the player.- Parameters:
audience
- The audience to send the message to.message
- The message to send.
-
sendPrefixedMessage
void sendPrefixedMessage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.Component message, boolean isShort, DMMessageUtils.Color color) Sends a prefixed message to the player.- Parameters:
player
- The player to send the message to.message
- The message to send.
-
sendPrefixedMessage
void sendPrefixedMessage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String message, boolean isShort, DMMessageUtils.Color color) Sends a prefixed message to the player.- Parameters:
player
- The player to send the message to.message
- The message to send.
-
sendPrefixedMessage
void sendPrefixedMessage(@NotNull @NotNull net.kyori.adventure.audience.Audience audience, @NotNull @NotNull net.kyori.adventure.text.Component message, boolean isShort) Sends a prefixed message to the player.- Parameters:
audience
- The audience to send the message to.message
- The message to send.
-
sendPrefixedMessage
void sendPrefixedMessage(@NotNull @NotNull net.kyori.adventure.audience.Audience audience, @NotNull @NotNull String message, boolean isShort) Sends a prefixed message to the player.- Parameters:
audience
- The audience to send the message to.message
- The message to send.
-
sendPrefixedMessage
void sendPrefixedMessage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.Component message, boolean isShort) Sends a prefixed message to the player.- Parameters:
player
- The player to send the message to.message
- The message to send.
-
sendPrefixedMessage
void sendPrefixedMessage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String message, boolean isShort) Sends a prefixed message to the player.- Parameters:
player
- The player to send the message to.message
- The message to send.
-
sendConfigurableMessage
void sendConfigurableMessage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String messageNode, @NotNull @NotNull List<Pair<String, String>> placeholders) Sends a configurable message to the player. These messages can be changed in the plugin's messages.yml. It will also replace PlaceholderAPI's placeholders if it is installed on the server.- Parameters:
player
- The player to send the message to.messageNode
- The message node to send to the player. The message node is the path to the message in the messages.yml. For example "example.message"placeholders
- The placeholders of the message. This is a list ofPair
s with the placeholder as key and the replacement as value. For example if you want to send a message like "Hello {PLAYER}!", you would useList.of(new Pair("{player}", player.getName()))
-
sendConfigurableMessage
void sendConfigurableMessage(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String messageNode, @NotNull @NotNull List<Pair<String, String>> placeholders) Sends a configurable message to the player. These messages can be changed in the plugin's messages.yml. It will also replace PlaceholderAPI's placeholders if it is installed on the server and if the sender is a player.- Parameters:
sender
- TheCommandSender
to send the message to.messageNode
- The message node to send to the player. The message node is the path to the message in the messages.yml. For example "example.message"placeholders
- The placeholders of the message. This is a list ofPair
s with the placeholder as key and the replacement as value. For example if you want to send a message like "Hello {PLAYER}!", you would useList.of(new Pair("{player}", player.getName()))
-
sendConfigurableMessage
void sendConfigurableMessage(@NotNull @NotNull net.kyori.adventure.audience.Audience audience, @NotNull @NotNull String messageNode, @NotNull @NotNull List<Pair<String, String>> placeholders) Sends a configurable message to the player. These messages can be changed in the plugin's messages.yml. With this method you CAN'T use PlaceholderAPI's placeholders.- Parameters:
audience
- The audience to send the message to.messageNode
- The message node to send to the player. The message node is the path to the message in the messages.yml. For example "example.message"placeholders
- The placeholders of the message. This is a list ofPair
s with the placeholder as key and the replacement as value. For example if you want to send a message like "Hello {PLAYER}!", you would useList.of(new Pair("{player}", player.getName()))
-
registerMessage
Registers a message in the plugin's messages.yml.- Parameters:
messageNode
- The path to the message in the messages.yml. For example "example.message"message
- The message to register.
-