Class TranslatableComponent

java.lang.Object
net.md_5.bungee.api.chat.BaseComponent
net.md_5.bungee.api.chat.TranslatableComponent

public final class TranslatableComponent extends BaseComponent
  • Constructor Details

    • TranslatableComponent

      public TranslatableComponent(TranslatableComponent original)
      Creates a translatable component from the original to clone it.
      Parameters:
      original - the original for the new translatable component.
    • TranslatableComponent

      public TranslatableComponent(String translate, Object... with)
      Creates a translatable component with the passed substitutions
      Parameters:
      translate - the translation key
      with - the Strings and BaseComponents to use into the translation
      See Also:
    • TranslatableComponent

      public TranslatableComponent(TranslationProvider translatable, Object... with)
      Creates a translatable component with the passed substitutions
      Parameters:
      translatable - the translatable object
      with - the Strings and BaseComponents to use into the translation
      See Also:
  • Method Details

    • duplicate

      public TranslatableComponent duplicate()
      Creates a duplicate of this TranslatableComponent.
      Specified by:
      duplicate in class BaseComponent
      Returns:
      the duplicate of this TranslatableComponent.
    • setWith

      public void setWith(List<BaseComponent> components)
      Sets the translation substitutions to be used in this component. Removes any previously set substitutions
      Parameters:
      components - the components to substitute
    • addWith

      public void addWith(String text)
      Adds a text substitution to the component. The text will inherit this component's formatting
      Parameters:
      text - the text to substitute
    • addWith

      public void addWith(BaseComponent component)
      Adds a component substitution to the component. The text will inherit this component's formatting
      Parameters:
      component - the component to substitute
    • toPlainText

      protected void toPlainText(StringBuilder builder)
    • toLegacyText

      protected void toLegacyText(StringBuilder builder)