Package me.neznamy.tab.api.chat
Enum Class EnumChatFormat
- All Implemented Interfaces:
Serializable,Comparable<EnumChatFormat>,Constable
An enum containing all possible legacy color codes and magic codes. Also contains handy color-related methods.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThe symbol minecraft uses to colorize textstatic final StringThe color symbol in form of a stringstatic final EnumChatFormat[]Creating a constant to avoid memory allocations on each request -
Method Summary
Modifier and TypeMethodDescriptionstatic StringColor translation method taken from bukkit, which converts '&' symbol into the actual color character if followed by a valid color character.static StringTurns back the color symbol into '&' symbol in provided text.static EnumChatFormatfromRGBExact(int red, int green, int blue) Returns enum value with exact red, green and blue values or null if no match was foundshortgetBlue()Returns blue value of this color codestatic EnumChatFormatgetByChar(char c) Returns enum value based on provided character or null if character is not validcharReturns character representing this colorReturns color char followed by color's charactershortgetGreen()Returns green value of this color codeReturns hex code of this format, null if this is a magic codestatic StringgetLastColors(String input) Code taken from bukkit, which returns last color codes used in provided text.shortgetRed()Returns red value of this color codestatic EnumChatFormatlastColorsOf(String string) Returns enum value of last colors used in given string.static EnumChatFormatReturns the enum constant of this class with the specified name.static EnumChatFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BLACK
-
DARK_BLUE
-
DARK_GREEN
-
DARK_AQUA
-
DARK_RED
-
DARK_PURPLE
-
GOLD
-
GRAY
-
DARK_GRAY
-
BLUE
-
GREEN
-
AQUA
-
RED
-
LIGHT_PURPLE
-
YELLOW
-
WHITE
-
OBFUSCATED
-
BOLD
-
STRIKETHROUGH
-
UNDERLINE
-
ITALIC
-
RESET
-
-
Field Details
-
VALUES
Creating a constant to avoid memory allocations on each request -
COLOR_CHAR
public static final char COLOR_CHARThe symbol minecraft uses to colorize text- See Also:
-
COLOR_STRING
The color symbol in form of a string
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getRed
public short getRed()Returns red value of this color code- Returns:
- red value
-
getGreen
public short getGreen()Returns green value of this color code- Returns:
- green value
-
getBlue
public short getBlue()Returns blue value of this color code- Returns:
- blue value
-
getByChar
Returns enum value based on provided character or null if character is not valid- Parameters:
c- color code character (0-9, a-f, k-o, r)- Returns:
- instance from the character or null if character is not valid
-
lastColorsOf
Returns enum value of last colors used in given string. If it's null, empty or does not contain color codes, WHITE is returned.- Parameters:
string- string to check last colors of- Returns:
- last used color code in given string or WHITE if nothing is found
-
getFormat
Returns color char followed by color's character- Returns:
- color char followed by color's character
-
getCharacter
public char getCharacter()Returns character representing this color- Returns:
- character representing this color
-
getHexCode
Returns hex code of this format, null if this is a magic code- Returns:
- hex code of this format
-
fromRGBExact
Returns enum value with exact red, green and blue values or null if no match was found- Parameters:
red- exact red valuegreen- exact green valueblue- exact blue value- Returns:
- enum value or null if no such combination exists
-
color
Color translation method taken from bukkit, which converts '&' symbol into the actual color character if followed by a valid color character.- Parameters:
textToTranslate- text to replace color symbol in- Returns:
- colorized string from provided text
-
decolor
Turns back the color symbol into '&' symbol in provided text.- Parameters:
text- text to revert colors in- Returns:
- reverted text
-
getLastColors
Code taken from bukkit, which returns last color codes used in provided text.- Parameters:
input- text to get last colors from- Returns:
- last colors used in provided text or empty string if nothing was found
-