Package net.md_5.bungee.api.chat

# Class TextComponent

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

public final class TextComponent extends BaseComponent

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class net.md_5.bungee.api.chat.BaseComponent

  `BaseComponent.LimitedStringVisitor, BaseComponent.StringVisitor`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TextComponent()`
  Creates a TextComponent with blank text.
  `TextComponent(String text)`
  Creates a new `TextComponent` instance.
  `TextComponent(BaseComponent... extras)`
  Creates a TextComponent with blank text and the extras set to the passed array
  `TextComponent(TextComponent textComponent)`
  Creates a TextComponent with formatting and text from the passed component

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `canEqual(Object other)`
  `TextComponent`
  `duplicate()`
  Creates a duplicate of this TextComponent.
  `boolean`
  `equals(Object o)`
  `static BaseComponent`
  `fromArray(BaseComponent... components)`
  Internal compatibility method to transform an array of components to a single component.
  `static BaseComponent`
  `fromLegacy(String message)`
  Converts the old formatting system that used `ChatColor.COLOR_CHAR` into the new json based system.
  `static BaseComponent`
  `fromLegacy(String message, ChatColor defaultColor)`
  Converts the old formatting system that used `ChatColor.COLOR_CHAR` into the new json based system.
  `static BaseComponent[]`
  `fromLegacyText(String message)`
  Deprecated.
  `fromLegacy(String)` is preferred as it will consolidate all components into a single BaseComponent with extra contents as opposed to an array of components which is non-standard and may result in unexpected behavior.
  `static BaseComponent[]`
  `fromLegacyText(String message, ChatColor defaultColor)`
  Deprecated.
  `fromLegacy(String, ChatColor)` is preferred as it will consolidate all components into a single BaseComponent with extra contents as opposed to an array of components which is non-standard and may result in unexpected behavior.
  `String`
  `getText()`
  The text of the component that will be displayed to the client
  `int`
  `hashCode()`
  `void`
  `setText(String text)`
  The text of the component that will be displayed to the client
  `protected void`
  `toLegacyText(BaseComponent.StringVisitor builder)`
  `protected void`
  `toPlainText(BaseComponent.StringVisitor builder)`
  `String`
  `toString()`

  ### Methods inherited from class net.md_5.bungee.api.chat.BaseComponent

  `addExtra, addExtra, applyStyle, copyFormatting, copyFormatting, copyFormatting, duplicateWithoutFormatting, getClickEvent, getColor, getColorRaw, getExtra, getFont, getFontRaw, getHoverEvent, getInsertion, getShadowColor, getShadowColorRaw, getStyle, hasFormatting, hasStyle, isBold, isBoldRaw, isItalic, isItalicRaw, isObfuscated, isObfuscatedRaw, isReset, isStrikethrough, isStrikethroughRaw, isUnderlined, isUnderlinedRaw, retain, setBold, setClickEvent, setColor, setExtra, setFont, setHoverEvent, setInsertion, setItalic, setObfuscated, setReset, setShadowColor, setStrikethrough, setStyle, setUnderlined, toLegacyText, toLegacyText, toPlainText, toPlainText`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### TextComponent

    public TextComponent()
    Creates a TextComponent with blank text.

  - ### TextComponent

    public TextComponent(TextComponent textComponent)
    Creates a TextComponent with formatting and text from the passed component
    Parameters:
      `textComponent` - the component to copy from

  - ### TextComponent

    public TextComponent(BaseComponent... extras)
    Creates a TextComponent with blank text and the extras set to the passed array
    Parameters:
      `extras` - the extras to set

  - ### TextComponent

    public TextComponent(String text)
    Creates a new `TextComponent` instance.
    Parameters:
      `text` - The text of the component that will be displayed to the client

- ## Method Details

  - ### fromLegacy

    public static BaseComponent fromLegacy(String message)
    Converts the old formatting system that used `ChatColor.COLOR_CHAR` into the new json based system.
    Parameters:
      `message` - the text to convert
    Returns:
      the components needed to print the message to the client

  - ### fromLegacy

    public static BaseComponent fromLegacy(String message, ChatColor defaultColor)
    Converts the old formatting system that used `ChatColor.COLOR_CHAR` into the new json based system.
    Parameters:
      `message` - the text to convert
      `defaultColor` - color to use when no formatting is to be applied (i.e. after ChatColor.RESET).
    Returns:
      the components needed to print the message to the client

  - ### fromLegacyText

    @Deprecated public static BaseComponent[] fromLegacyText(String message)
    Deprecated.
    `fromLegacy(String)` is preferred as it will consolidate all components into a single BaseComponent with extra contents as opposed to an array of components which is non-standard and may result in unexpected behavior.
    Converts the old formatting system that used `ChatColor.COLOR_CHAR` into the new json based system.
    Parameters:
      `message` - the text to convert
    Returns:
      the components needed to print the message to the client

  - ### fromLegacyText

    @Deprecated public static BaseComponent[] fromLegacyText(String message, ChatColor defaultColor)
    Deprecated.
    `fromLegacy(String, ChatColor)` is preferred as it will consolidate all components into a single BaseComponent with extra contents as opposed to an array of components which is non-standard and may result in unexpected behavior.
    Converts the old formatting system that used `ChatColor.COLOR_CHAR` into the new json based system.
    Parameters:
      `message` - the text to convert
      `defaultColor` - color to use when no formatting is to be applied (i.e. after ChatColor.RESET).
    Returns:
      the components needed to print the message to the client

  - ### fromArray

    public static BaseComponent fromArray(BaseComponent... components)
    Internal compatibility method to transform an array of components to a single component.
    Parameters:
      `components` - array
    Returns:
      single component

  - ### duplicate

    public TextComponent duplicate()
    Creates a duplicate of this TextComponent.
    Specified by:
      `duplicate` in class `BaseComponent`
    Returns:
      the duplicate of this TextComponent.

  - ### toPlainText

    protected void toPlainText(BaseComponent.StringVisitor builder)

  - ### toLegacyText

    protected void toLegacyText(BaseComponent.StringVisitor builder)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `BaseComponent`

  - ### getText

    public String getText()
    The text of the component that will be displayed to the client

  - ### setText

    public void setText(String text)
    The text of the component that will be displayed to the client

  - ### 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`