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()
  • 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)
    • getFormat

      public Pattern getFormat()
    • getTranslate

      public String getTranslate()
      The key into the Minecraft locale files to use for the translation. The text depends on the client's locale setting. The console is always en_US
    • getWith

      public List<BaseComponent> getWith()
      The components to substitute into the translation
    • getFallback

      public String getFallback()
      The fallback, if the translation is not found
    • setTranslate

      public void setTranslate(String translate)
      The key into the Minecraft locale files to use for the translation. The text depends on the client's locale setting. The console is always en_US
    • setFallback

      public void setFallback(String fallback)
      The fallback, if the translation is not found
    • toString

      public String toString()
      Overrides:
      toString in class BaseComponent
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class BaseComponent
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class BaseComponent
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BaseComponent