Package net.md_5.bungee.api.chat
Class 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);
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSet 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.strikethrough
(Boolean strikethrough) Set the style's strikethrough property.underlined
(Boolean underlined) Set the style's underlined property.
-
Constructor Details
-
ComponentStyleBuilder
public ComponentStyleBuilder()
-
-
Method Details
-
color
Set the style color.- Parameters:
color
- the color to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
font
Set the style font.- Parameters:
font
- the font key to set, or null to use the default- Returns:
- this ComponentStyleBuilder for chaining
-
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
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
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
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
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
Build theComponentStyle
using the values set in this builder.- Returns:
- the created ComponentStyle
-