Interface ComponentStringBuilder

All Superinterfaces:
Appendable

public interface ComponentStringBuilder extends Appendable
A component string builder.
  • Method Details

    • plain

      Returns a plain component string builder. Will not apply any text styles or colors.
      Parameters:
      context - the context
      provider - the component renderer provider
      Returns:
      the plain component string builder
    • plain

      static ComponentStringBuilder plain(KeyContainer context)
      Returns a plain component string builder. Will not apply any text styles or colors.

      Uses the component renderer provided by Distributor.

      Parameters:
      context - the context
      Returns:
      the plain component string builder
    • ansi

      Returns an ANSI component string builder. Will apply ANSI escape codes for text styles and colors.

      If a valid ANSI escape code is found in an appended text, it will be removed.

      Parameters:
      context - the context
      provider - the component renderer provider
      Returns:
      the ANSI component string builder
    • ansi

      static ComponentStringBuilder ansi(KeyContainer context)
      Returns an ANSI component string builder. Will apply ANSI escape codes for text styles and colors.

      If a valid ANSI escape code is found in an appended text, it will be removed.

      Uses the component renderer provided by Distributor.

      Parameters:
      context - the context
      Returns:
      the ANSI component string builder
    • mindustry

      static ComponentStringBuilder mindustry(KeyContainer context, ComponentRendererProvider provider)
      Returns a Mindustry component string builder. Will apply Mindustry-specific text colors.

      If an open square bracket is found in an appended text, it will be replaced with a double square bracket.

      Parameters:
      context - the context
      provider - the component renderer provider
      Returns:
      the Mindustry component string builder
    • mindustry

      static ComponentStringBuilder mindustry(KeyContainer context)
      Returns a Mindustry component string builder. Will apply Mindustry-specific text colors.

      If an open square bracket is found in an appended text, it will be replaced with a double square bracket.

      Uses the component renderer provided by Distributor.

      Parameters:
      context - the context
      Returns:
      the Mindustry component string builder
    • getContext

      KeyContainer getContext()
      Returns the context of this builder.
    • append

      ComponentStringBuilder append(Component component)
      Appends the specified component.
      Parameters:
      component - the component
      Returns:
      this builder
    • append

      ComponentStringBuilder append(@Nullable CharSequence csq)
      Specified by:
      append in interface Appendable
    • append

      ComponentStringBuilder append(@Nullable CharSequence csq, int start, int end)
      Specified by:
      append in interface Appendable
    • append

      ComponentStringBuilder append(char c)
      Specified by:
      append in interface Appendable
    • toString

      String toString()
      Returns the rendered string.
      Overrides:
      toString in class Object