Package com.ultikits.ultitools.utils
Class MessageUtils
java.lang.Object
com.ultikits.ultitools.utils.MessageUtils
Message utils.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcoloredMsg(String message) Get a colored string, using & as color code.static StringGet error message (dark red).static StringGet info message (light blue).static StringGet a colored string.static voidsendMessage(org.bukkit.entity.Player player, String msg) Send a colored message to player, using & as color code.static voidsendMessage(org.bukkit.entity.Player player, String msg, char alternateColorCodes) Send a colored message to player, using custom color code.static voidsendMessage(org.bukkit.entity.Player player, net.kyori.adventure.text.TextComponent textComponent) Send an Adventure component message to player.static StringGet warning message (light red).
-
Constructor Details
-
MessageUtils
public MessageUtils()
-
-
Method Details
-
msg
Get a colored string.- Parameters:
chatColor- the chat colormessage- the message- Returns:
- the string
-
sendMessage
Send a colored message to player, using & as color code.- Parameters:
player- the playermsg- the msg
-
sendMessage
public static void sendMessage(org.bukkit.entity.Player player, String msg, char alternateColorCodes) Send a colored message to player, using custom color code.- Parameters:
player- the playermsg- the msgalternateColorCodes- the alternate color codes
-
sendMessage
public static void sendMessage(org.bukkit.entity.Player player, net.kyori.adventure.text.TextComponent textComponent) Send an Adventure component message to player.The component goes through the player's own Adventure
Audience, which Paper implements natively, so click and hover events reach the client unchanged and one component arrives as one chat message.It must not go through
adventure-platform-bukkit'sBukkitAudiences. Measured on Paper 1.21.11: that library (4.3.2) cannot find the server's internal component serializer there, so its chat facet falls back to legacy section-sign text. Every click and hover event is dropped and every newline becomes a separate chat line, which left the/upm listInstall/Uninstall buttons and the chat confirm buttons doing nothing when clicked.- Parameters:
player- the playertextComponent- the text component
-
coloredMsg
Get a colored string, using & as color code.- Parameters:
message- the message- Returns:
- the string
-
info
Get info message (light blue).- Parameters:
message- the message- Returns:
- the string
-
warning
Get warning message (light red).- Parameters:
message- the message- Returns:
- the string
-
error
Get error message (dark red).- Parameters:
message- the message- Returns:
- the string
-