程序包 cn.nukkit.utils

Enum Class TextFormat

java.lang.Object
java.lang.Enum<TextFormat>
cn.nukkit.utils.TextFormat
所有已实现的接口:
Serializable, Comparable<TextFormat>, Constable

public enum TextFormat extends Enum<TextFormat>
All supported formatting values for chat and console.
  • 枚举常量详细资料

    • BLACK

      public static final TextFormat BLACK
      Represents black.
    • DARK_BLUE

      public static final TextFormat DARK_BLUE
      Represents dark blue.
    • DARK_GREEN

      public static final TextFormat DARK_GREEN
      Represents dark green.
    • DARK_AQUA

      public static final TextFormat DARK_AQUA
      Represents dark blue (aqua).
    • DARK_RED

      public static final TextFormat DARK_RED
      Represents dark red.
    • DARK_PURPLE

      public static final TextFormat DARK_PURPLE
      Represents dark purple.
    • GOLD

      public static final TextFormat GOLD
      Represents gold.
    • GRAY

      public static final TextFormat GRAY
      Represents gray.
    • DARK_GRAY

      public static final TextFormat DARK_GRAY
      Represents dark gray.
    • BLUE

      public static final TextFormat BLUE
      Represents blue.
    • GREEN

      public static final TextFormat GREEN
      Represents green.
    • AQUA

      public static final TextFormat AQUA
      Represents aqua.
    • RED

      public static final TextFormat RED
      Represents red.
    • LIGHT_PURPLE

      public static final TextFormat LIGHT_PURPLE
      Represents light purple.
    • YELLOW

      public static final TextFormat YELLOW
      Represents yellow.
    • WHITE

      public static final TextFormat WHITE
      Represents white.
    • MINECOIN_GOLD

      public static final TextFormat MINECOIN_GOLD
      Represents minecoins gold.
    • OBFUSCATED

      public static final TextFormat OBFUSCATED
      Makes the text obfuscated.
    • BOLD

      public static final TextFormat BOLD
      Makes the text bold.
    • STRIKETHROUGH

      public static final TextFormat STRIKETHROUGH
      Makes a line appear through the text.
    • UNDERLINE

      public static final TextFormat UNDERLINE
      Makes the text appear underlined.
    • ITALIC

      public static final TextFormat ITALIC
      Makes the text italic.
    • RESET

      public static final TextFormat RESET
      Resets all previous chat colors or formats.
  • 字段详细资料

    • ESCAPE

      public static final char ESCAPE
      The special character which prefixes all format codes. Use this if you need to dynamically convert format codes from your custom format.
      另请参阅:
  • 方法详细资料

    • values

      public static TextFormat[] 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

      public static TextFormat valueOf(String name)
      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 name
      NullPointerException - 如果参数为空值
    • getByChar

      public static TextFormat getByChar(char code)
      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

      public static TextFormat getByChar(String code)
      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

      public static String clean(String input)
      Cleans the given message of all format codes.
      参数:
      input - String to clean.
      返回:
      A copy of the input string, without any formatting.
    • clean

      public static String clean(String input, boolean recursive)
    • colorize

      public static String colorize(char altFormatChar, String textToTranslate)
      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

      public static String colorize(String textToTranslate)
      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

      public static String getLastColors(String input)
      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

      public String 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.