Package me.lokka30.levelledmobs.util
Class MessageUtils
java.lang.Object
me.lokka30.levelledmobs.util.MessageUtils
This class contains a bunch of methods which
make it very easy to translate '&'-based color
codes in messages. You can colorize standard codes
(&a, &b, &1, &2, etc), and even hex codes (&#abccdef),
and also both in one method :)
- Since:
- 1.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull String
colorizeAll
(String msg) Colorize a message, using '&' color codes - e.g.static String
colorizeHexCodes
(String msg) This defaults the 'startTag' to '&#' and endTag to '' (nothing) to colorizeHexCodes.static String
colorizeHexCodes
(String startTag, String endTag, String message) (WARNING!) This does NOT colorize standard codes, ONLY hex codes.static @NotNull String
This does NOT colorize hex codes, ONLY standard codes.
-
Constructor Details
-
MessageUtils
public MessageUtils()
-
-
Method Details
-
colorizeAll
Colorize a message, using '&' color codes - e.g. '&a' for ChatColor.GREEN. If the server is 1.16 or newer, then it will also translate hex codes - e.g. '&#abcdef'.- Parameters:
msg
- the message to translate color codes from.- Returns:
- the color-translated message.
- Since:
- unknown
- See Also:
-
colorizeHexCodes
This defaults the 'startTag' to '&#' and endTag to '' (nothing) to colorizeHexCodes.- Parameters:
msg
- message to translate- Returns:
- the translated string
- Since:
- unknown
- See Also:
-
colorizeHexCodes
(WARNING!) This does NOT colorize standard codes, ONLY hex codes. This translates all hex codes in a message. Hex codes are prefixed by '&#', e.g. '&#abcdef'. This method ensures the version is 1.16 or newer before translating - else, it will not translate the message.- Parameters:
startTag
- what the tag should begin with - '&#' is recommendedendTag
- what the tag should end with - '' (nothing) is recommendedmessage
- the message that should be translated- Returns:
- the translated string
- Since:
- unknown
-
colorizeStandardCodes
This does NOT colorize hex codes, ONLY standard codes. This translated all standard codes in a message. Standard codes are prefixed by '&', e.g. '&a'.- Parameters:
msg
- the message to translate standard color codes from.- Returns:
- the color-translated message.
- Since:
- unknown
-