-
Notifications
You must be signed in to change notification settings - Fork 0
HexUtils
Minecraft 1.16 introduced a whole new way to use with colors: HEX codes.
Thanks to this update, we are now able to use 16.8 million colors in our plugin messages, making them more user-friendly and colorful.
BearCommands offers a various set of functions to work with HEX codes in the HexUtils class.
We will go through some of these to understand their usefulness:
public static String parseString(String message, boolean removeIfNotParsable, boolean forceUnHEX);This is the most basic function. It will convert all the HEX codes found in String message to their respective HEX colors.
Note that, as previously stated, this will only work in Minecraft 1.16.
If you are on a lower version, then the boolean removeIfNotParsable parameter comes into play:
if set to true, it will simply remove all the HEX codes, without coloring the string.
If you want this kind of behaviour to happen even in Minecraft 1.16 and above, you can simply set boolean forceUnHEX to true.
public static List<String> extractHexCodes(String message);As the name suggests, all this function does is extrapolate all the HEX codes found inside String message and return them into a list.
This is mainly useful for parseString().
public static String unParseHexColor(String message);The direct opponent of parseString(), it converts back any HEX color found in String message into its original HEX code.
- Home
- How to start a plugin
- Work with Configuration Files
- Work with Enums
- Work with Commands
- Work with Custom Players
- Work with Messaging Channels
- Creating custom SavableObjects
- Timers
- General Utils
- Placeholders
- Bukkit Utils
- Velocity Utils