Package net.md_5.bungee.api.chat
Class ComponentStyleBuilder
- java.lang.Object
-
- net.md_5.bungee.api.chat.ComponentStyleBuilder
-
public final class ComponentStyleBuilder extends Object
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);
-
-
Constructor Summary
Constructors Constructor Description ComponentStyleBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComponentStyleBuilderbold(Boolean bold)Set the style's bold property.ComponentStylebuild()Build theComponentStyleusing the values set in this builder.ComponentStyleBuildercolor(ChatColor color)Set the style color.ComponentStyleBuilderfont(String font)Set the style font.ComponentStyleBuilderitalic(Boolean italic)Set the style's italic property.ComponentStyleBuilderobfuscated(Boolean obfuscated)Set the style's obfuscated property.ComponentStyleBuilderstrikethrough(Boolean strikethrough)Set the style's strikethrough property.ComponentStyleBuilderunderlined(Boolean underlined)Set the style's underlined property.
-
-
-
Method Detail
-
color
public ComponentStyleBuilder color(ChatColor color)
Set the style color.- Parameters:
color- the color to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
font
public ComponentStyleBuilder font(String font)
Set the style font.- Parameters:
font- the font key to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
bold
public ComponentStyleBuilder bold(Boolean bold)
Set the style's bold property.- Parameters:
bold- the bold value to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
italic
public ComponentStyleBuilder italic(Boolean italic)
Set the style's italic property.- Parameters:
italic- the italic value to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
underlined
public ComponentStyleBuilder underlined(Boolean underlined)
Set the style's underlined property.- Parameters:
underlined- the underlined value to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
strikethrough
public ComponentStyleBuilder strikethrough(Boolean strikethrough)
Set the style's strikethrough property.- Parameters:
strikethrough- the strikethrough value to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
obfuscated
public ComponentStyleBuilder obfuscated(Boolean obfuscated)
Set the style's obfuscated property.- Parameters:
obfuscated- the obfuscated value to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
build
public ComponentStyle build()
Build theComponentStyleusing the values set in this builder.- Returns:
- the created ComponentStyle
-
-