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
-
-
Constructor Summary
Constructors Constructor Description TextComponent()Creates a TextComponent with blank text.TextComponent(String 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)TextComponentduplicate()Creates a duplicate of this TextComponent.booleanequals(Object o)static BaseComponent[]fromLegacyText(String message)Converts the old formatting system that usedChatColor.COLOR_CHARinto the new json based system.static BaseComponent[]fromLegacyText(String message, ChatColor defaultColor)Converts the old formatting system that usedChatColor.COLOR_CHARinto the new json based system.StringgetText()The text of the component that will be displayed to the clientinthashCode()voidsetText(String text)The text of the component that will be displayed to the clientprotected voidtoLegacyText(StringBuilder builder)protected voidtoPlainText(StringBuilder builder)StringtoString()-
Methods inherited from class net.md_5.bungee.api.chat.BaseComponent
addExtra, addExtra, copyFormatting, copyFormatting, copyFormatting, duplicateWithoutFormatting, getClickEvent, getColor, getColorRaw, getExtra, getFont, getFontRaw, getHoverEvent, getInsertion, hasFormatting, isBold, isBoldRaw, isItalic, isItalicRaw, isObfuscated, isObfuscatedRaw, isReset, isStrikethrough, isStrikethroughRaw, isUnderlined, isUnderlinedRaw, retain, setBold, setClickEvent, setColor, setExtra, setFont, setHoverEvent, setInsertion, setItalic, setObfuscated, setReset, setStrikethrough, setUnderlined, toLegacyText, toLegacyText, toPlainText, toPlainText
-
-
-
-
Constructor Detail
-
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)
-
-
Method Detail
-
fromLegacyText
public static BaseComponent[] fromLegacyText(String message)
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
public static BaseComponent[] fromLegacyText(String message, ChatColor defaultColor)
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
-
duplicate
public TextComponent duplicate()
Creates a duplicate of this TextComponent.- Specified by:
duplicatein classBaseComponent- Returns:
- the duplicate of this TextComponent.
-
toPlainText
protected void toPlainText(StringBuilder builder)
-
toLegacyText
protected void toLegacyText(StringBuilder builder)
-
toString
public String toString()
- Overrides:
toStringin classBaseComponent
-
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:
equalsin classBaseComponent
-
canEqual
protected boolean canEqual(Object other)
- Overrides:
canEqualin classBaseComponent
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBaseComponent
-
-