类 BaseComponent
java.lang.Object
net.md_5.bungee.api.chat.BaseComponent
-
构造器概要
-
方法概要
修饰符和类型方法说明void
Appends a text element to the component.void
addExtra
(BaseComponent component) Appends a component to the component.protected boolean
void
copyFormatting
(BaseComponent component) 复制指定 BaseComponent 的事件和格式.void
copyFormatting
(BaseComponent component, boolean replace) 复制指定 BaseComponent 的事件和格式.void
copyFormatting
(BaseComponent component, ComponentBuilder.FormatRetention retention, boolean replace) 复制某个 BaseComponent 中的指定格式.abstract BaseComponent
克隆本组件并返回克隆副本.已过时。不鼓励使用本 API, 建议使用传统克隆副本boolean
当此组件(含子组件)被点击时执行的动作.getColor()
Returns the color of this component.Returns the color of this component without checking the parents color.getExtra()
继承该组件的格式和事件的附加组件.getFont()
Returns the font of this component.Returns the font of this component without checking the parents font.当鼠标光标悬浮在此组件(含子组件)时执行的动作.当按住shift键点击此组件(包含子组件)时, 向聊天消息输入框插入的文本.boolean
Returns whether the component has any formatting or events applied to itint
hashCode()
boolean
isBold()
Returns whether this component is bold.Returns whether this component is bold without checking the parents setting.boolean
isItalic()
Returns whether this component is italic.Returns whether this component is italic without checking the parents setting.boolean
Returns whether this component is obfuscated.Returns whether this component is obfuscated without checking the parents setting.boolean
Returns whether this component is strikethrough.Returns whether this component is strikethrough without checking the parents setting.boolean
Returns whether this component is underlined.Returns whether this component is underlined without checking the parents setting.void
retain
(ComponentBuilder.FormatRetention retention) 仅保留指定的格式.void
该组件及其子组件是否加粗(子组件可定义它们各自的颜色及其格式来覆盖母组件的设定, 下同).void
setClickEvent
(ClickEvent clickEvent) 当此组件(含子组件)被点击时执行的动作.void
该组件及其子组件的颜色(除非子组件定义了自己的颜色覆盖母组件的颜色).void
setExtra
(List<BaseComponent> components) void
该组件及其子组件的字体(除非子组件定义了自己的字体覆盖母组件的字体).void
setHoverEvent
(HoverEvent hoverEvent) 当鼠标光标悬浮在此组件(含子组件)时执行的动作.void
setInsertion
(String insertion) 当按住shift键点击此组件(包含子组件)时, 向聊天消息输入框插入的文本.void
该组件及其子组件是否为斜体(可覆盖).void
setObfuscated
(Boolean obfuscated) 该组件及其子组件是否为随机字符(可覆盖).void
setStrikethrough
(Boolean strikethrough) 该组件及其子组件是否添加删除线(可覆盖).void
setUnderlined
(Boolean underlined) 该组件及其子组件是否添加下划线(可覆盖).Converts the component to a string that uses the old formatting codes (ChatColor.COLOR_CHAR
static String
toLegacyText
(BaseComponent... components) 将聊天组件转化为颜色代码文本.Converts the component into a string without any formattingstatic String
toPlainText
(BaseComponent... components) 将聊天组件转化为字符串, 丢弃所有格式.toString()
-
构造器详细资料
-
BaseComponent
已过时。仅供内部使用, 将被移除默认构造器.
-
-
方法详细资料
-
copyFormatting
复制指定 BaseComponent 的事件和格式. 已设置的格式将被替换.原文:Copies the events and formatting of a BaseComponent. Already set formatting will be replaced.
- 参数:
component
- 要复制的组件
-
copyFormatting
复制指定 BaseComponent 的事件和格式.原文:Copies the events and formatting of a BaseComponent.
- 参数:
component
- 要复制的组件replace
- 已设置的格式是否被新的组件替换
-
copyFormatting
public void copyFormatting(BaseComponent component, ComponentBuilder.FormatRetention retention, boolean replace) 复制某个 BaseComponent 中的指定格式.原文:Copies the specified formatting of a BaseComponent.
- 参数:
component
- 要复制的组件retention
- 要复制的格式replace
- 已设置的格式是否被新的组件替换
-
retain
仅保留指定的格式.原文:Retains only the specified formatting.
- 参数:
retention
- 要保留的格式
-
duplicate
克隆本组件并返回克隆副本.原文:Clones the BaseComponent and returns the clone.
- 返回:
- 该组件的副本
-
duplicateWithoutFormatting
已过时。不鼓励使用本 API, 建议使用传统克隆副本克隆本组件并返回克隆副本, 不保留原副本的格式.原文:Clones the BaseComponent without formatting and returns the clone.
- 返回:
- 该组件的副本
-
toLegacyText
将聊天组件转化为颜色代码文本.原文:Converts the components to a string that uses the old formatting codes (
ChatColor.COLOR_CHAR
- 参数:
components
- 要转化的组件- 返回:
- 旧版颜色代码文本
-
toPlainText
将聊天组件转化为字符串, 丢弃所有格式.原文:Converts the components into a string without any formatting
- 参数:
components
- 要转化的组件- 返回:
- 纯文本
-
getColor
Returns the color of this component. This uses the parent's color if this component doesn't have one.ChatColor.WHITE
is returned if no color is found.- 返回:
- the color of this component
-
getColorRaw
Returns the color of this component without checking the parents color. May return null- 返回:
- the color of this component
-
getFont
Returns the font of this component. This uses the parent's font if this component doesn't have one.- 返回:
- the font of this component, or null if default font
-
getFontRaw
Returns the font of this component without checking the parents font. May return null- 返回:
- the font of this component
-
isBold
public boolean isBold()Returns whether this component is bold. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.- 返回:
- whether the component is bold
-
isBoldRaw
Returns whether this component is bold without checking the parents setting. May return null- 返回:
- whether the component is bold
-
isItalic
public boolean isItalic()Returns whether this component is italic. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.- 返回:
- whether the component is italic
-
isItalicRaw
Returns whether this component is italic without checking the parents setting. May return null- 返回:
- whether the component is italic
-
isUnderlined
public boolean isUnderlined()Returns whether this component is underlined. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.- 返回:
- whether the component is underlined
-
isUnderlinedRaw
Returns whether this component is underlined without checking the parents setting. May return null- 返回:
- whether the component is underlined
-
isStrikethrough
public boolean isStrikethrough()Returns whether this component is strikethrough. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.- 返回:
- whether the component is strikethrough
-
isStrikethroughRaw
Returns whether this component is strikethrough without checking the parents setting. May return null- 返回:
- whether the component is strikethrough
-
isObfuscated
public boolean isObfuscated()Returns whether this component is obfuscated. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.- 返回:
- whether the component is obfuscated
-
isObfuscatedRaw
Returns whether this component is obfuscated without checking the parents setting. May return null- 返回:
- whether the component is obfuscated
-
setExtra
-
addExtra
Appends a text element to the component. The text will inherit this component's formatting- 参数:
text
- the text to append
-
addExtra
Appends a component to the component. The text will inherit this component's formatting- 参数:
component
- the component to append
-
hasFormatting
public boolean hasFormatting()Returns whether the component has any formatting or events applied to it- 返回:
- Whether any formatting or events are applied
-
toPlainText
Converts the component into a string without any formatting- 返回:
- the string as plain text
-
toLegacyText
Converts the component to a string that uses the old formatting codes (ChatColor.COLOR_CHAR
- 返回:
- the string in the old format
-
setColor
该组件及其子组件的颜色(除非子组件定义了自己的颜色覆盖母组件的颜色). -
setFont
该组件及其子组件的字体(除非子组件定义了自己的字体覆盖母组件的字体). -
setBold
该组件及其子组件是否加粗(子组件可定义它们各自的颜色及其格式来覆盖母组件的设定, 下同). -
setItalic
该组件及其子组件是否为斜体(可覆盖). -
setUnderlined
该组件及其子组件是否添加下划线(可覆盖). -
setStrikethrough
该组件及其子组件是否添加删除线(可覆盖). -
setObfuscated
该组件及其子组件是否为随机字符(可覆盖). -
setInsertion
当按住shift键点击此组件(包含子组件)时, 向聊天消息输入框插入的文本. -
setClickEvent
当此组件(含子组件)被点击时执行的动作. -
setHoverEvent
当鼠标光标悬浮在此组件(含子组件)时执行的动作. -
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getInsertion
当按住shift键点击此组件(包含子组件)时, 向聊天消息输入框插入的文本. -
getExtra
继承该组件的格式和事件的附加组件. -
getClickEvent
当此组件(含子组件)被点击时执行的动作. -
getHoverEvent
当鼠标光标悬浮在此组件(含子组件)时执行的动作.
-