类 ChatColor
java.lang.Object
net.md_5.bungee.api.ChatColor
聊天消息所有支持的颜色.
-
字段概要
字段修饰符和类型字段说明static final Stringstatic final ChatColor淡蓝: 淡蓝static final ChatColor黑色: 黑色static final ChatColor蓝色: 蓝色static final ChatColor粗体: 粗体static final char所有聊天颜色代码的特殊字符前辍.如果你需要动态转换您自定义格式的颜色代码,请使用这个.static final ChatColor深蓝: 深蓝static final ChatColor深蓝: 深蓝static final ChatColor深灰: 深灰static final ChatColor深绿: 深绿static final ChatColor深紫: 深紫static final ChatColor深红: 深红static final ChatColor橙色: 橙色static final ChatColor灰色: 灰色static final ChatColor绿色: 绿色static final ChatColor斜体: 斜体static final ChatColor紫色: 紫色static final ChatColor随机字符(聊天不可用)static final ChatColor红色: 红色static final ChatColor重置字体颜色以及效果static final ChatColor删除线: 删除线static final Pattern用于移除所有颜色代码的正则表达式static final ChatColor下划线: 下划线static final ChatColor白色: 白色static final ChatColor黄色: 黄色 -
方法概要
修饰符和类型方法说明booleanstatic ChatColorgetByChar(char code) 获取指定的颜色代码代表的颜色或格式.getColor()此ChatColor的RGB颜色. null表示无颜色(formatting)getName()inthashCode()name()已过时。holdover from when this class was an enumstatic ChatColorstatic ChatColorintordinal()已过时。holdover from when this class was an enumstatic StringstripColor(String input) 去除给定消息的所有颜色代码.toString()static StringtranslateAlternateColorCodes(char altColorChar, String textToTranslate) 转换交替的颜色代码字符到内部的ChatColor.COLOR_CHAR颜色代码字符.如果它后面紧跟着的是0-9, A-F, a-f, K-O, k-o, R 或 r,其它的颜色代码只会被替换.static ChatColor已过时。holdover from when this class was an enumstatic ChatColor[]values()已过时。holdover from when this class was an enum
-
字段详细资料
-
COLOR_CHAR
public static final char COLOR_CHAR所有聊天颜色代码的特殊字符前辍.如果你需要动态转换您自定义格式的颜色代码,请使用这个.- 另请参阅:
-
ALL_CODES
- 另请参阅:
-
STRIP_COLOR_PATTERN
用于移除所有颜色代码的正则表达式 -
BLACK
黑色: 黑色 -
DARK_BLUE
深蓝: 深蓝 -
DARK_GREEN
深绿: 深绿 -
DARK_AQUA
深蓝: 深蓝 -
DARK_RED
深红: 深红 -
DARK_PURPLE
深紫: 深紫 -
GOLD
橙色: 橙色 -
GRAY
灰色: 灰色 -
DARK_GRAY
深灰: 深灰 -
BLUE
蓝色: 蓝色 -
GREEN
绿色: 绿色 -
AQUA
淡蓝: 淡蓝 -
RED
红色: 红色 -
LIGHT_PURPLE
紫色: 紫色 -
YELLOW
黄色: 黄色 -
WHITE
白色: 白色 -
MAGIC
随机字符(聊天不可用) -
BOLD
粗体: 粗体 -
STRIKETHROUGH
删除线: 删除线 -
UNDERLINE
下划线: 下划线 -
ITALIC
斜体: 斜体 -
RESET
重置字体颜色以及效果
-
-
方法详细资料
-
hashCode
public int hashCode() -
equals
-
toString
-
stripColor
去除给定消息的所有颜色代码.原文:Strips the given message of all color codes
- 参数:
input- 要去除颜色的字符串- 返回:
- 没有颜色代码的字符串副本
-
translateAlternateColorCodes
转换交替的颜色代码字符到内部的ChatColor.COLOR_CHAR颜色代码字符.如果它后面紧跟着的是0-9, A-F, a-f, K-O, k-o, R 或 r,其它的颜色代码只会被替换.译注:这个方法是用来把其他的颜色代码替换成Minecraft本身的.比如我们在Minecraft服务器聊天时,为了输入方便,就使用"&"来替换"§",服务器要处理这种消息时就要用到本方法.
范例:
System.out.println(translateAlternateColorCodes('&', "&cred&agreen&9blue"));这段代码会把"&cred&agreen&9blue"替换成"§cred§agreen§9blue","§"是ChatColor.COLOR_CHAR的默认值.原文: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.
- 参数:
altColorChar- 要替换的其他颜色代码.比如:&textToTranslate- 包含了其他颜色代码的字符- 返回:
- 包含了ChatColor.COLOR_CHAR颜色代码字符的文本
-
getByChar
获取指定的颜色代码代表的颜色或格式.原文:Get the colour represented by the specified code.
- 参数:
code- 要检测的代码- 返回:
- 与给定代码相关联的
ChatColor,如果不存在则为null
-
of
-
of
-
valueOf
已过时。holdover from when this class was an enum- 参数:
name- 颜色名- 返回:
- ChatColor
-
values
已过时。holdover from when this class was an enum获取包含所有已定义的颜色和格式的数组.原文:Get an array of all defined colors and formats.
- 返回:
- 所有颜色和格式的数组的副本
-
name
已过时。holdover from when this class was an enum另请参见Enum.name().- 返回:
- 常量名
-
ordinal
已过时。holdover from when this class was an enum另请参见Enum.ordinal().- 返回:
- 颜色代码序数
-
getName
-
getColor
此ChatColor的RGB颜色. null表示无颜色(formatting)
-