程序包 cn.nukkit.utils
Enum Class TextFormat
- 所有已实现的接口:
Serializable
,Comparable<TextFormat>
,Constable
All supported formatting values for chat and console.
-
嵌套类概要
从类继承的嵌套类/接口 java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
枚举常量概要
枚举常量说明Represents aqua.Represents black.Represents blue.Makes the text bold.Represents dark blue (aqua).Represents dark blue.Represents dark gray.Represents dark green.Represents dark purple.Represents dark red.Represents gold.Represents gray.Represents green.Makes the text italic.Represents light purple.Represents minecoins gold.Makes the text obfuscated.Represents red.Resets all previous chat colors or formats.Makes a line appear through the text.Makes the text appear underlined.Represents white.Represents yellow. -
字段概要
-
方法概要
修饰符和类型方法说明static String
Cleans the given message of all format codes.static String
static String
Translates a string using an alternate format code character into a string that uses the internal TextFormat.ESCAPE format code character.static String
Translates a string, using an ampersand (&) as an alternate format code character, into a string that uses the internal TextFormat.ESCAPE format code character.static TextFormat
getByChar
(char code) Gets the TextFormat represented by the specified format code.static TextFormat
Gets the TextFormat represented by the specified format code.char
getChar()
Gets the char value associated with this colorstatic String
getLastColors
(String input) Gets the chat color used at the end of the given input string.boolean
isColor()
Checks if this code is a color code as opposed to a format code.boolean
isFormat()
Checks if this code is a format code as opposed to a color code.toString()
static TextFormat
Returns the enum constant of this class with the specified name.static TextFormat[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
枚举常量详细资料
-
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. -
MINECOIN_GOLD
Represents minecoins gold. -
OBFUSCATED
Makes the text obfuscated. -
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.
-
-
字段详细资料
-
ESCAPE
public static final char ESCAPEThe special character which prefixes all format codes. Use this if you need to dynamically convert format codes from your custom format.- 另请参阅:
-
-
方法详细资料
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- 返回:
- 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.)- 参数:
name
- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- 如果参数为空值
-
getByChar
Gets the TextFormat represented by the specified format code.- 参数:
code
- Code to check- 返回:
- Associative
TextFormat
with the given code, or null if it doesn't exist
-
getByChar
Gets the TextFormat represented by the specified format code.- 参数:
code
- Code to check- 返回:
- Associative
TextFormat
with the given code, or null if it doesn't exist
-
clean
Cleans the given message of all format codes.- 参数:
input
- String to clean.- 返回:
- A copy of the input string, without any formatting.
-
clean
-
colorize
Translates a string using an alternate format code character into a string that uses the internal TextFormat.ESCAPE format code character. The alternate format code character will only be replaced if it is immediately followed by 0-9, A-G, a-g, K-O, k-o, R or r.- 参数:
altFormatChar
- The alternate format code character to replace. Ex: &textToTranslate
- Text containing the alternate format code character.- 返回:
- Text containing the TextFormat.ESCAPE format code character.
-
colorize
Translates a string, using an ampersand (&) as an alternate format code character, into a string that uses the internal TextFormat.ESCAPE format code character. The alternate format code character will only be replaced if it is immediately followed by 0-9, A-G, a-g, K-O, k-o, R or r.- 参数:
textToTranslate
- Text containing the alternate format code character.- 返回:
- Text containing the TextFormat.ESCAPE format code character.
-
getLastColors
Gets the chat color used at the end of the given input string.- 参数:
input
- Input string to retrieve the colors from.- 返回:
- Any remaining chat color to pass onto the next line.
-
getChar
public char getChar()Gets the char value associated with this color- 返回:
- A char value of this color code
-
toString
- 覆盖:
toString
在类中Enum<TextFormat>
-
isFormat
public boolean isFormat()Checks if this code is a format code as opposed to a color code. -
isColor
public boolean isColor()Checks if this code is a color code as opposed to a format code.
-