Interface FormatProvider


public interface FormatProvider
Provides formatting info to a command.
  • Method Summary

    Modifier and Type
    Method
    Description
    default net.kyori.adventure.text.Component
    formatAccent​(@NotNull String input)
    Formats text using the accent colour.
    net.kyori.adventure.text.Component
    formatAccent​(@NotNull String input, @NotNull net.kyori.adventure.text.format.TextDecoration[] formatters)
    Formats text using the accent colour.
    default net.kyori.adventure.text.Component
    formatFooter​(String input)
    Formats text into a footer, intended to be shown as the last line of a message.
    default net.kyori.adventure.text.Component
    formatMain​(@NotNull String input)
    Formats text using the main colour.
    net.kyori.adventure.text.Component
    formatMain​(@NotNull String input, @NotNull net.kyori.adventure.text.format.TextDecoration[] formatters)
    Formats text using the main colour.
    default net.kyori.adventure.text.Component
    formatTitle​(String input)
    Formats title text.
    net.kyori.adventure.text.Component
    Get a prefix, which is put before most command messages.
  • Method Details

    • formatMain

      default net.kyori.adventure.text.Component formatMain(@NotNull @NotNull String input)
      Formats text using the main colour.
      Parameters:
      input - the text to format
      Returns:
      the formatted text
    • formatMain

      net.kyori.adventure.text.Component formatMain(@NotNull @NotNull String input, @NotNull @NotNull net.kyori.adventure.text.format.TextDecoration[] formatters)
      Formats text using the main colour.
      Parameters:
      input - the text to format
      formatters - a string of vanilla formatter codes to apply, for example "lo" for bold and italic
      Returns:
      the formatted text
    • formatAccent

      default net.kyori.adventure.text.Component formatAccent(@NotNull @NotNull String input)
      Formats text using the accent colour.
      Parameters:
      input - the text to format
      Returns:
      the formatted text
    • formatAccent

      net.kyori.adventure.text.Component formatAccent(@NotNull @NotNull String input, @NotNull @NotNull net.kyori.adventure.text.format.TextDecoration[] formatters)
      Formats text using the accent colour.
      Parameters:
      input - the text to format
      formatters - a string of vanilla formatter codes to apply, for example "lo" for bold and italic
      Returns:
      the formatted text
    • formatTitle

      default net.kyori.adventure.text.Component formatTitle(String input)
      Formats title text. This defaults to the old TextFormatter#formatTitle behaviour (centre-aligned title text with solid accent-coloured bars either side). This should be overridden for the Discord platform as centre-alignment does not work there due to a different font.
      Parameters:
      input - the text to act as the title
      Returns:
      the formatted text
      Since:
      2.0.0
    • formatFooter

      default net.kyori.adventure.text.Component formatFooter(String input)
      Formats text into a footer, intended to be shown as the last line of a message. By default, this behaves the same as formatTitle(String).
      Parameters:
      input - the text to act as the footer
      Returns:
      the formatted text
      Since:
      2.0.0
    • getPrefix

      net.kyori.adventure.text.Component getPrefix()
      Get a prefix, which is put before most command messages.
      Returns:
      a preformatted colour sequence