类 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);
 
另请参阅:
  • 构造器详细资料

    • ComponentStyleBuilder

      public ComponentStyleBuilder()
  • 方法详细资料

    • color

      public ComponentStyleBuilder color(ChatColor color)
      Set the style color.
      参数:
      color - the color to set, or null to use the default
      返回:
      this ComponentStyleBuilder for chaining
    • shadowColor

      public ComponentStyleBuilder shadowColor(Color shadowColor)
      Set the style shadow color.
      参数:
      shadowColor - the shadow color to set, or null to use the default
      返回:
      this ComponentStyleBuilder for chaining
    • font

      public ComponentStyleBuilder font(String font)
      Set the style font.
      参数:
      font - the font key to set, or null to use the default
      返回:
      this ComponentStyleBuilder for chaining
    • bold

      public ComponentStyleBuilder bold(Boolean bold)
      Set the style's bold property.
      参数:
      bold - the bold value to set, or null to use the default
      返回:
      this ComponentStyleBuilder for chaining
    • italic

      public ComponentStyleBuilder italic(Boolean italic)
      Set the style's italic property.
      参数:
      italic - the italic value to set, or null to use the default
      返回:
      this ComponentStyleBuilder for chaining
    • underlined

      public ComponentStyleBuilder underlined(Boolean underlined)
      Set the style's underlined property.
      参数:
      underlined - the underlined value to set, or null to use the default
      返回:
      this ComponentStyleBuilder for chaining
    • strikethrough

      public ComponentStyleBuilder strikethrough(Boolean strikethrough)
      Set the style's strikethrough property.
      参数:
      strikethrough - the strikethrough value to set, or null to use the default
      返回:
      this ComponentStyleBuilder for chaining
    • obfuscated

      public ComponentStyleBuilder obfuscated(Boolean obfuscated)
      Set the style's obfuscated property.
      参数:
      obfuscated - the obfuscated value to set, or null to use the default
      返回:
      this ComponentStyleBuilder for chaining
    • build

      public ComponentStyle build()
      Build the ComponentStyle using the values set in this builder.
      返回:
      the created ComponentStyle