类 TextComponent

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

public final class TextComponent extends BaseComponent
  • 构造器详细资料

    • 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
      参数:
      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
      参数:
      extras - the extras to set
  • 方法详细资料

    • fromLegacy

      public static BaseComponent fromLegacy(String message)
      Converts the old formatting system that used ChatColor.COLOR_CHAR into the new json based system.
      参数:
      message - the text to convert
      返回:
      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.
      参数:
      message - the text to convert
      defaultColor - color to use when no formatting is to be applied (i.e. after ChatColor.RESET).
      返回:
      the components needed to print the message to the client
    • fromLegacyText

      @Deprecated public static BaseComponent[] fromLegacyText(String message)
      已过时。
      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.
      参数:
      message - the text to convert
      返回:
      the components needed to print the message to the client
    • fromLegacyText

      @Deprecated public static BaseComponent[] fromLegacyText(String message, ChatColor defaultColor)
      已过时。
      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.
      参数:
      message - the text to convert
      defaultColor - color to use when no formatting is to be applied (i.e. after ChatColor.RESET).
      返回:
      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.
      参数:
      components - array
      返回:
      single component
    • duplicate

      public TextComponent duplicate()
      Creates a duplicate of this TextComponent.
      指定者:
      duplicate 在类中 BaseComponent
      返回:
      the duplicate of this TextComponent.
    • toPlainText

      protected void toPlainText(BaseComponent.StringVisitor builder)
    • toLegacyText

      protected void toLegacyText(BaseComponent.StringVisitor builder)
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object