Class ChatMessageBuilder

java.lang.Object
me.internalizable.numdrassl.api.chat.ChatMessageBuilder

public final class ChatMessageBuilder extends Object
Builder for creating formatted chat messages.

Provides a fluent API for constructing formatted messages with colors, bold, italic, underline, and other styling.

Example usage:

ChatMessageBuilder message = ChatMessageBuilder.create()
    .green("[Success] ")
    .white("Operation completed!");

player.sendMessage(message);
See Also:
  • Method Details

    • create

      @Nonnull public static ChatMessageBuilder create()
      Creates a new builder instance.
      Returns:
      a new ChatMessageBuilder
    • text

      @Nonnull public ChatMessageBuilder text(@Nonnull String text, @Nonnull String hexColor)
      Appends text with the specified hex color.
      Parameters:
      text - the text to append
      hexColor - the color in hex format (e.g., "#FF5555")
      Returns:
      this builder
    • bold

      @Nonnull public ChatMessageBuilder bold(@Nonnull String text, @Nonnull String hexColor)
      Appends bold text with the specified hex color.
      Parameters:
      text - the text to append
      hexColor - the color in hex format
      Returns:
      this builder
    • italic

      @Nonnull public ChatMessageBuilder italic(@Nonnull String text, @Nonnull String hexColor)
      Appends italic text with the specified hex color.
      Parameters:
      text - the text to append
      hexColor - the color in hex format
      Returns:
      this builder
    • underline

      @Nonnull public ChatMessageBuilder underline(@Nonnull String text, @Nonnull String hexColor)
      Appends underlined text with the specified hex color.
      Parameters:
      text - the text to append
      hexColor - the color in hex format
      Returns:
      this builder
    • strikethrough

      @Nonnull public ChatMessageBuilder strikethrough(@Nonnull String text, @Nonnull String hexColor)
      Appends strikethrough text with the specified hex color.
      Parameters:
      text - the text to append
      hexColor - the color in hex format
      Returns:
      this builder
    • red

      @Nonnull public ChatMessageBuilder red(@Nonnull String text)
      Appends red colored text.
    • darkRed

      @Nonnull public ChatMessageBuilder darkRed(@Nonnull String text)
      Appends dark red colored text.
    • green

      @Nonnull public ChatMessageBuilder green(@Nonnull String text)
      Appends green colored text.
    • darkGreen

      @Nonnull public ChatMessageBuilder darkGreen(@Nonnull String text)
      Appends dark green colored text.
    • gold

      @Nonnull public ChatMessageBuilder gold(@Nonnull String text)
      Appends gold/orange colored text.
    • yellow

      @Nonnull public ChatMessageBuilder yellow(@Nonnull String text)
      Appends yellow colored text.
    • aqua

      @Nonnull public ChatMessageBuilder aqua(@Nonnull String text)
      Appends aqua/cyan colored text.
    • darkAqua

      @Nonnull public ChatMessageBuilder darkAqua(@Nonnull String text)
      Appends dark aqua colored text.
    • blue

      @Nonnull public ChatMessageBuilder blue(@Nonnull String text)
      Appends blue colored text.
    • darkBlue

      @Nonnull public ChatMessageBuilder darkBlue(@Nonnull String text)
      Appends dark blue colored text.
    • purple

      @Nonnull public ChatMessageBuilder purple(@Nonnull String text)
      Appends purple/magenta colored text.
    • darkPurple

      @Nonnull public ChatMessageBuilder darkPurple(@Nonnull String text)
      Appends dark purple colored text.
    • white

      @Nonnull public ChatMessageBuilder white(@Nonnull String text)
      Appends white colored text.
    • gray

      @Nonnull public ChatMessageBuilder gray(@Nonnull String text)
      Appends gray colored text.
    • darkGray

      @Nonnull public ChatMessageBuilder darkGray(@Nonnull String text)
      Appends dark gray colored text.
    • black

      @Nonnull public ChatMessageBuilder black(@Nonnull String text)
      Appends black colored text.
    • getParts

      @Nonnull public List<FormattedMessagePart> getParts()
      Gets all the message parts.
      Returns:
      an unmodifiable list of message parts
    • build

      @Nonnull public FormattedMessagePart build()
      Builds the formatted message as a single part containing all children.
      Returns:
      the built FormattedMessagePart