类 ComponentStyleBuilder
java.lang.Object
net.md_5.bungee.api.chat.ComponentStyleBuilder
ComponentStyleBuilder simplifies creating component styles by allowing the use of a chainable builder.
ComponentStyle style = ComponentStyle.builder() .color(ChatColor.RED) .font("custom:font") .bold(true).italic(true).create(); BaseComponent component = new ComponentBuilder("Hello world").style(style).create(); // Or it can be used directly on a component TextComponent text = new TextComponent("Hello world"); text.applyStyle(style);
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Set the style's bold property.build()
Build theComponentStyle
using the values set in this builder.Set the style color.Set the style font.Set the style's italic property.obfuscated
(Boolean obfuscated) Set the style's obfuscated property.shadowColor
(Color shadowColor) Set the style shadow color.strikethrough
(Boolean strikethrough) Set the style's strikethrough property.underlined
(Boolean underlined) Set the style's underlined property.
-
构造器详细资料
-
ComponentStyleBuilder
public ComponentStyleBuilder()
-
-
方法详细资料
-
color
Set the style color.- 参数:
color
- the color to set, or null to use the default- 返回:
- this ComponentStyleBuilder for chaining
-
shadowColor
Set the style shadow color.- 参数:
shadowColor
- the shadow color to set, or null to use the default- 返回:
- this ComponentStyleBuilder for chaining
-
font
Set the style font.- 参数:
font
- the font key to set, or null to use the default- 返回:
- this ComponentStyleBuilder for chaining
-
bold
Set the style's bold property.- 参数:
bold
- the bold value to set, or null to use the default- 返回:
- this ComponentStyleBuilder for chaining
-
italic
Set the style's italic property.- 参数:
italic
- the italic value to set, or null to use the default- 返回:
- this ComponentStyleBuilder for chaining
-
underlined
Set the style's underlined property.- 参数:
underlined
- the underlined value to set, or null to use the default- 返回:
- this ComponentStyleBuilder for chaining
-
strikethrough
Set the style's strikethrough property.- 参数:
strikethrough
- the strikethrough value to set, or null to use the default- 返回:
- this ComponentStyleBuilder for chaining
-
obfuscated
Set the style's obfuscated property.- 参数:
obfuscated
- the obfuscated value to set, or null to use the default- 返回:
- this ComponentStyleBuilder for chaining
-
build
Build theComponentStyle
using the values set in this builder.- 返回:
- the created ComponentStyle
-