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
-
Nested Class Summary
Nested classes/interfaces inherited from class net.md_5.bungee.api.chat.BaseComponent
BaseComponent.LimitedStringVisitor, BaseComponent.StringVisitor -
Constructor Summary
ConstructorsConstructorDescriptionCreates a TextComponent with blank text.TextComponent(BaseComponent... extras) Creates a TextComponent with blank text and the extras set to the passed arrayTextComponent(TextComponent textComponent) Creates a TextComponent with formatting and text from the passed component -
Method Summary
Modifier and TypeMethodDescriptionCreates a duplicate of this TextComponent.static BaseComponentfromArray(BaseComponent... components) Internal compatibility method to transform an array of components to a single component.static BaseComponentfromLegacy(String message) Converts the old formatting system that usedChatColor.COLOR_CHARinto the new json based system.static BaseComponentfromLegacy(String message, ChatColor defaultColor) Converts the old formatting system that usedChatColor.COLOR_CHARinto the new json based system.static BaseComponent[]fromLegacyText(String message) Deprecated.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.protected voidtoLegacyText(BaseComponent.StringVisitor builder) protected voidtoPlainText(BaseComponent.StringVisitor builder) toString()Methods inherited from class net.md_5.bungee.api.chat.BaseComponent
addExtra, addExtra, applyStyle, copyFormatting, copyFormatting, copyFormatting, duplicateWithoutFormatting, getColor, getColorRaw, getFont, getFontRaw, getShadowColor, getShadowColorRaw, hasFormatting, hasStyle, isBold, isBoldRaw, isItalic, isItalicRaw, isObfuscated, isObfuscatedRaw, isStrikethrough, isStrikethroughRaw, isUnderlined, isUnderlinedRaw, retain, setBold, setColor, setExtra, setFont, setItalic, setObfuscated, setShadowColor, setStrikethrough, setStyle, setUnderlined, toLegacyText, toLegacyText, toPlainText, toPlainText
-
Constructor Details
-
TextComponent
public TextComponent()Creates a TextComponent with blank text. -
TextComponent
Creates a TextComponent with formatting and text from the passed component- Parameters:
textComponent- the component to copy from
-
TextComponent
Creates a TextComponent with blank text and the extras set to the passed array- Parameters:
extras- the extras to set
-
-
Method Details
-
fromLegacy
Converts the old formatting system that usedChatColor.COLOR_CHARinto the new json based system.- Parameters:
message- the text to convert- Returns:
- the components needed to print the message to the client
-
fromLegacy
Converts the old formatting system that usedChatColor.COLOR_CHARinto the new json based system.- Parameters:
message- the text to convertdefaultColor- 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.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 usedChatColor.COLOR_CHARinto the new json based system.- Parameters:
message- the text to convert- Returns:
- the components needed to print the message to the client
-
fromLegacyText
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 usedChatColor.COLOR_CHARinto the new json based system.- Parameters:
message- the text to convertdefaultColor- 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
Internal compatibility method to transform an array of components to a single component.- Parameters:
components- array- Returns:
- single component
-
duplicate
Creates a duplicate of this TextComponent.- Specified by:
duplicatein classBaseComponent- Returns:
- the duplicate of this TextComponent.
-
toPlainText
-
toLegacyText
-
toString
-
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.