Package me.neznamy.tab.api.chat.rgb
Class RGBUtils
java.lang.Object
me.neznamy.tab.api.chat.rgb.RGBUtils
A helper class to reformat all RGB formats into the default #RRGGBB and apply gradients
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyCleanGradients(String text) Applies all gradient formats to text and returns it.applyFormats(String text) Applies all RGB formats and gradients to text and returns it.convertRGBtoLegacy(String text) Converts all hex codes in given string to legacy codesconvertToBukkitFormat(String text, boolean rgbClient) Converts TAB's RGB format (#RRGGBB) into bukkit one (&x&r&r&g&g&b&b) for modern clients (1.16+), for legacy clients it will use the closest color.static RGBUtilsReturns instance of this classbooleanReturns true if entered string is a valid 6-digit combination of hexadecimal numbers, false if not
-
Constructor Details
-
RGBUtils
public RGBUtils()Constructs new instance and loads all RGB patterns and gradients
-
-
Method Details
-
getInstance
Returns instance of this class- Returns:
- instance
-
applyFormats
Applies all RGB formats and gradients to text and returns it.- Parameters:
text- original text- Returns:
- text where everything is converted to #RRGGBB
-
applyCleanGradients
Applies all gradient formats to text and returns it. This only affects usage where no placeholder is used inside.- Parameters:
text- original text- Returns:
- text where all gradients with static text are converted to #RRGGBB
-
convertToBukkitFormat
Converts TAB's RGB format (#RRGGBB) into bukkit one (&x&r&r&g&g&b&b) for modern clients (1.16+), for legacy clients it will use the closest color.- Parameters:
text- text to convertrgbClient- whether client accepts RGB or not- Returns:
- converted text
-
convertRGBtoLegacy
Converts all hex codes in given string to legacy codes- Parameters:
text- text to convert- Returns:
- translated text
-
isHexCode
Returns true if entered string is a valid 6-digit combination of hexadecimal numbers, false if not- Parameters:
string- string to check- Returns:
trueif valid,falseif not
-