Package org.bukkit
Enum Class ChatColor
- All Implemented Interfaces:
- Serializable,- Comparable<ChatColor>,- Constable
All supported color values for chat
- 
Nested Class SummaryNested classes/interfaces inherited from class java.lang.EnumEnum.EnumDesc<E extends Enum<E>>
- 
Enum Constant SummaryEnum ConstantsEnum ConstantDescriptionRepresents aquaRepresents blackRepresents blueMakes the text bold.Represents dark blue (aqua)Represents dark blueRepresents dark grayRepresents dark greenRepresents dark purpleRepresents dark redRepresents goldRepresents grayRepresents greenMakes the text italic.Represents light purpleRepresents magical characters that change around randomlyRepresents redResets all previous chat colors or formats.Makes a line appear through the text.Makes the text appear underlined.Represents whiteRepresents yellow
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final charThe special character which prefixes all chat colour codes.
- 
Method SummaryModifier and TypeMethodDescriptionnet.md_5.bungee.api.ChatColorasBungee()static ChatColorgetByChar(char code) Gets the color represented by the specified color codestatic ChatColorGets the color represented by the specified color codechargetChar()Gets the char value associated with this colorstatic StringgetLastColors(String input) Gets the ChatColors used at the end of the given input string.booleanisColor()Checks if this code is a color code as opposed to a format code.booleanisFormat()Checks if this code is a format code as opposed to a color code.static StringstripColor(String input) Strips the given message of all color codestoString()static StringtranslateAlternateColorCodes(char altColorChar, String textToTranslate) Translates a string using an alternate color code character into a string that uses the internal ChatColor.COLOR_CODE color code character.static ChatColorReturns the enum constant of this class with the specified name.static ChatColor[]values()Returns an array containing the constants of this enum class, in the order they are declared.
- 
Enum Constant Details- 
BLACKRepresents black
- 
DARK_BLUERepresents dark blue
- 
DARK_GREENRepresents dark green
- 
DARK_AQUARepresents dark blue (aqua)
- 
DARK_REDRepresents dark red
- 
DARK_PURPLERepresents dark purple
- 
GOLDRepresents gold
- 
GRAYRepresents gray
- 
DARK_GRAYRepresents dark gray
- 
BLUERepresents blue
- 
GREENRepresents green
- 
AQUARepresents aqua
- 
REDRepresents red
- 
LIGHT_PURPLERepresents light purple
- 
YELLOWRepresents yellow
- 
WHITERepresents white
- 
MAGICRepresents magical characters that change around randomly
- 
BOLDMakes the text bold.
- 
STRIKETHROUGHMakes a line appear through the text.
- 
UNDERLINEMakes the text appear underlined.
- 
ITALICMakes the text italic.
- 
RESETResets all previous chat colors or formats.
 
- 
- 
Field Details- 
COLOR_CHARpublic static final char COLOR_CHARThe special character which prefixes all chat colour codes. Use this if you need to dynamically convert colour codes from your custom format.- See Also:
 
 
- 
- 
Method Details- 
valuesReturns 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
 
- 
valueOfReturns 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 name
- NullPointerException- if the argument is null
 
- 
asBungee@NotNull public net.md_5.bungee.api.ChatColor asBungee()
- 
getCharpublic char getChar()Gets the char value associated with this color- Returns:
- A char value of this color code
 
- 
toString
- 
isFormatpublic boolean isFormat()Checks if this code is a format code as opposed to a color code.- Returns:
- whether this ChatColor is a format code
 
- 
isColorpublic boolean isColor()Checks if this code is a color code as opposed to a format code.- Returns:
- whether this ChatColor is a color code
 
- 
getByCharGets the color represented by the specified color code- Parameters:
- code- Code to check
- Returns:
- Associative ChatColorwith the given code, or null if it doesn't exist
 
- 
getByCharGets the color represented by the specified color code- Parameters:
- code- Code to check
- Returns:
- Associative ChatColorwith the given code, or null if it doesn't exist
 
- 
stripColor@Contract("!null -> !null; null -> null") @Nullable public static String stripColor(@Nullable String input) Strips the given message of all color codes- Parameters:
- input- String to strip of color
- Returns:
- A copy of the input string, without any coloring
 
- 
translateAlternateColorCodes@NotNull public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) Translates a string using an alternate color code character into a string that uses the internal ChatColor.COLOR_CODE color code character. The alternate color code character will only be replaced if it is immediately followed by 0-9, A-F, a-f, K-O, k-o, R or r.- Parameters:
- altColorChar- The alternate color code character to replace. Ex: &
- textToTranslate- Text containing the alternate color code character.
- Returns:
- Text containing the ChatColor.COLOR_CODE color code character.
 
- 
getLastColorsGets the ChatColors used at the end of the given input string.- Parameters:
- input- Input string to retrieve the colors from.
- Returns:
- Any remaining ChatColors to pass onto the next line.
 
 
-