Package org.bukkit
Enum ChatColor
java.lang.Object
java.lang.Enum<ChatColor>
org.bukkit.ChatColor
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<ChatColor>,java.lang.constant.Constable
public enum ChatColor extends java.lang.Enum<ChatColor>
All supported color values for chat
-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description AQUARepresents aquaBLACKRepresents blackBLUERepresents blueBOLDMakes the text bold.DARK_AQUARepresents dark blue (aqua)DARK_BLUERepresents dark blueDARK_GRAYRepresents dark grayDARK_GREENRepresents dark greenDARK_PURPLERepresents dark purpleDARK_REDRepresents dark redGOLDRepresents goldGRAYRepresents grayGREENRepresents greenITALICMakes the text italic.LIGHT_PURPLERepresents light purpleMAGICRepresents magical characters that change around randomlyREDRepresents redRESETResets all previous chat colors or formats.STRIKETHROUGHMakes a line appear through the text.UNDERLINEMakes the text appear underlined.WHITERepresents whiteYELLOWRepresents yellow -
Field Summary
Fields Modifier and Type Field Description static charCOLOR_CHARThe special character which prefixes all chat colour codes. -
Method Summary
Modifier and Type Method Description net.md_5.bungee.api.ChatColorasBungee()static ChatColorgetByChar(char code)Gets the color represented by the specified color codestatic ChatColorgetByChar(java.lang.String code)Gets the color represented by the specified color codechargetChar()Gets the char value associated with this colorstatic java.lang.StringgetLastColors(java.lang.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 java.lang.StringstripColor(java.lang.String input)Strips the given message of all color codesjava.lang.StringtoString()static java.lang.StringtranslateAlternateColorCodes(char altColorChar, java.lang.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 ChatColorvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static ChatColor[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
BLACK
Represents black -
DARK_BLUE
Represents dark blue -
DARK_GREEN
Represents dark green -
DARK_AQUA
Represents dark blue (aqua) -
DARK_RED
Represents dark red -
DARK_PURPLE
Represents dark purple -
GOLD
Represents gold -
GRAY
Represents gray -
DARK_GRAY
Represents dark gray -
BLUE
Represents blue -
GREEN
Represents green -
AQUA
Represents aqua -
RED
Represents red -
LIGHT_PURPLE
Represents light purple -
YELLOW
Represents yellow -
WHITE
Represents white -
MAGIC
Represents magical characters that change around randomly -
BOLD
Makes the text bold. -
STRIKETHROUGH
Makes a line appear through the text. -
UNDERLINE
Makes the text appear underlined. -
ITALIC
Makes the text italic. -
RESET
Resets all previous chat colors or formats.
-
-
Field Details
-
COLOR_CHAR
public 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:
- Constant Field Values
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
asBungee
public net.md_5.bungee.api.ChatColor asBungee() -
getChar
public char getChar()Gets the char value associated with this color- Returns:
- A char value of this color code
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Enum<ChatColor>
-
isFormat
public boolean isFormat()Checks if this code is a format code as opposed to a color code.- Returns:
- whether this ChatColor is a format code
-
isColor
public boolean isColor()Checks if this code is a color code as opposed to a format code.- Returns:
- whether this ChatColor is a color code
-
getByChar
Gets 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
-
getByChar
Gets 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
public static java.lang.String stripColor(java.lang.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
public static java.lang.String translateAlternateColorCodes(char altColorChar, java.lang.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.
-
getLastColors
public static java.lang.String getLastColors(java.lang.String input)Gets 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.
-