类 BaseComponent

    • 构造器详细资料

      • BaseComponent

        @Deprecated
        public BaseComponent()
        已过时。
        for use by internal classes only, will be removed.
        Default constructor.
    • 方法详细资料

      • copyFormatting

        public void copyFormatting​(BaseComponent component)
        Copies the events and formatting of a BaseComponent. Already set formatting will be replaced.
        参数:
        component - the component to copy from
      • copyFormatting

        public void copyFormatting​(BaseComponent component,
                                   boolean replace)
        Copies the events and formatting of a BaseComponent.
        参数:
        component - the component to copy from
        replace - if already set formatting should be replaced by the new component
      • copyFormatting

        public void copyFormatting​(BaseComponent component,
                                   ComponentBuilder.FormatRetention retention,
                                   boolean replace)
        Copies the specified formatting of a BaseComponent.
        参数:
        component - the component to copy from
        retention - the formatting to copy
        replace - if already set formatting should be replaced by the new component
      • retain

        public void retain​(ComponentBuilder.FormatRetention retention)
        Retains only the specified formatting.
        参数:
        retention - the formatting to retain
      • duplicate

        public abstract BaseComponent duplicate()
        Clones the BaseComponent and returns the clone.
        返回:
        The duplicate of this BaseComponent
      • duplicateWithoutFormatting

        @Deprecated
        public BaseComponent duplicateWithoutFormatting()
        已过时。
        API use discouraged, use traditional duplicate
        Clones the BaseComponent without formatting and returns the clone.
        返回:
        The duplicate of this BaseComponent
      • toLegacyText

        public static java.lang.String toLegacyText​(BaseComponent... components)
        Converts the components to a string that uses the old formatting codes (ChatColor.COLOR_CHAR
        参数:
        components - the components to convert
        返回:
        the string in the old format
      • toPlainText

        public static java.lang.String toPlainText​(BaseComponent... components)
        Converts the components into a string without any formatting
        参数:
        components - the components to convert
        返回:
        the string as plain text
      • getColor

        public ChatColor getColor()
        Returns the color of this component. This uses the parent's color if this component doesn't have one. ChatColor.WHITE is returned if no color is found.
        返回:
        the color of this component
      • getColorRaw

        public ChatColor getColorRaw()
        Returns the color of this component without checking the parents color. May return null
        返回:
        the color of this component
      • getFont

        public java.lang.String getFont()
        Returns the font of this component. This uses the parent's font if this component doesn't have one.
        返回:
        the font of this component, or null if default font
      • getFontRaw

        public java.lang.String getFontRaw()
        Returns the font of this component without checking the parents font. May return null
        返回:
        the font of this component
      • isBold

        public boolean isBold()
        Returns whether this component is bold. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.
        返回:
        whether the component is bold
      • isBoldRaw

        public java.lang.Boolean isBoldRaw()
        Returns whether this component is bold without checking the parents setting. May return null
        返回:
        whether the component is bold
      • isItalic

        public boolean isItalic()
        Returns whether this component is italic. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.
        返回:
        whether the component is italic
      • isItalicRaw

        public java.lang.Boolean isItalicRaw()
        Returns whether this component is italic without checking the parents setting. May return null
        返回:
        whether the component is italic
      • isUnderlined

        public boolean isUnderlined()
        Returns whether this component is underlined. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.
        返回:
        whether the component is underlined
      • isUnderlinedRaw

        public java.lang.Boolean isUnderlinedRaw()
        Returns whether this component is underlined without checking the parents setting. May return null
        返回:
        whether the component is underlined
      • isStrikethrough

        public boolean isStrikethrough()
        Returns whether this component is strikethrough. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.
        返回:
        whether the component is strikethrough
      • isStrikethroughRaw

        public java.lang.Boolean isStrikethroughRaw()
        Returns whether this component is strikethrough without checking the parents setting. May return null
        返回:
        whether the component is strikethrough
      • isObfuscated

        public boolean isObfuscated()
        Returns whether this component is obfuscated. This uses the parent's setting if this component hasn't been set. false is returned if none of the parent chain has been set.
        返回:
        whether the component is obfuscated
      • isObfuscatedRaw

        public java.lang.Boolean isObfuscatedRaw()
        Returns whether this component is obfuscated without checking the parents setting. May return null
        返回:
        whether the component is obfuscated
      • setExtra

        public void setExtra​(java.util.List<BaseComponent> components)
      • addExtra

        public void addExtra​(java.lang.String text)
        Appends a text element to the component. The text will inherit this component's formatting
        参数:
        text - the text to append
      • addExtra

        public void addExtra​(BaseComponent component)
        Appends a component to the component. The text will inherit this component's formatting
        参数:
        component - the component to append
      • hasFormatting

        public boolean hasFormatting()
        Returns whether the component has any formatting or events applied to it
        返回:
        Whether any formatting or events are applied
      • toPlainText

        public java.lang.String toPlainText()
        Converts the component into a string without any formatting
        返回:
        the string as plain text
      • toLegacyText

        public java.lang.String toLegacyText()
        Converts the component to a string that uses the old formatting codes (ChatColor.COLOR_CHAR
        返回:
        the string in the old format
      • setColor

        public void setColor​(ChatColor color)
      • setFont

        public void setFont​(java.lang.String font)
      • setBold

        public void setBold​(java.lang.Boolean bold)
      • setItalic

        public void setItalic​(java.lang.Boolean italic)
      • setUnderlined

        public void setUnderlined​(java.lang.Boolean underlined)
      • setStrikethrough

        public void setStrikethrough​(java.lang.Boolean strikethrough)
      • setObfuscated

        public void setObfuscated​(java.lang.Boolean obfuscated)
      • setInsertion

        public void setInsertion​(java.lang.String insertion)
      • setClickEvent

        public void setClickEvent​(ClickEvent clickEvent)
      • setHoverEvent

        public void setHoverEvent​(HoverEvent hoverEvent)
      • equals

        public boolean equals​(java.lang.Object o)
        覆盖:
        equals 在类中 java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 在类中 java.lang.Object
      • toString

        public java.lang.String toString()
        覆盖:
        toString 在类中 java.lang.Object
      • getInsertion

        public java.lang.String getInsertion()
      • getClickEvent

        public ClickEvent getClickEvent()
      • getHoverEvent

        public HoverEvent getHoverEvent()