Class AudienceUtil
java.lang.Object
net.mathias2246.buildmc.util.AudienceUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.kyori.adventure.text.minimessage.tag.resolver.TagResolver.Single[]mapPlaceholders(Map<String, ?> richPlaceholders) static @NotNull StringrenderPlainMessage(@NotNull org.bukkit.command.CommandSender sender, @NotNull String miniMessage, @NotNull Map<String, ?> plainPlaceholders) static net.kyori.adventure.text.ComponentrenderRichMessage(@NotNull org.bukkit.command.CommandSender sender, @NotNull String miniMessage, @NotNull Map<String, ?> richPlaceholders) Resolves placeholders inside a MiniMessage string and renders translations using theGlobalTranslator.render(Component, Locale)method.static voidsendActionBar(@NotNull net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component message) static voidsendMessage(@NotNull net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component message) static voidsendRichMessage(@NotNull org.bukkit.command.CommandSender sender, @NotNull String miniMessage, @NotNull Map<String, ?> richPlaceholders) Resolves placeholders inside a MiniMessage string and displays it to aCommandSender.
-
Constructor Details
-
AudienceUtil
public AudienceUtil()
-
-
Method Details
-
sendMessage
public static void sendMessage(@NotNull @NotNull net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component message) -
sendActionBar
public static void sendActionBar(@NotNull @NotNull net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component message) -
sendRichMessage
public static void sendRichMessage(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String miniMessage, @NotNull @NotNull Map<String, ?> richPlaceholders) Resolves placeholders inside a MiniMessage string and displays it to aCommandSender.- Parameters:
sender- TheCommandSenderto send the rich message to.miniMessage- The MiniMessage string to parse.
Resolves custom tags e.g. "Hello <player-name>!" using the entries inside the richPlaceholders maprichPlaceholders- AMapof placeholders to resolve. The key is the name inside the custom mini message tag.
The entry can be aComponentorTagResolver.Single.
Every other type will be converted usingObject.toString()and is parsed as mini message text.
-
renderRichMessage
public static net.kyori.adventure.text.Component renderRichMessage(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String miniMessage, @NotNull @NotNull Map<String, ?> richPlaceholders) Resolves placeholders inside a MiniMessage string and renders translations using theGlobalTranslator.render(Component, Locale)method.This can be used for creating rendered component names for
ItemStacks becauseTranslatableComponents cannot be translated on the server-side automatically.- Parameters:
sender- TheCommandSenderto send the rich message to.miniMessage- The MiniMessage string to parse.
Resolves custom tags e.g. "Hello <player-name>!" using the entries inside the richPlaceholders maprichPlaceholders- AMapof placeholders to resolve. The key is the name inside the custom mini message tag.
The entry can be aComponentorTagResolver.Single.
Every other type will be converted usingObject.toString()and is parsed as mini message text.
-
renderPlainMessage
-
mapPlaceholders
-