public final class TextComponent extends BaseComponent
| Constructor and Description |
|---|
TextComponent()
Creates a TextComponent with blank text.
|
TextComponent(BaseComponent... extras)
Creates a TextComponent with blank text and the extras set to the passed
array
|
TextComponent(String text) |
TextComponent(TextComponent textComponent)
Creates a TextComponent with formatting and text from the passed
component
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canEqual(Object other) |
TextComponent |
duplicate()
Creates a duplicate of this TextComponent.
|
boolean |
equals(Object o) |
static BaseComponent[] |
fromLegacyText(String message)
Converts the old formatting system that used
ChatColor.COLOR_CHAR into the new json based
system. |
static BaseComponent[] |
fromLegacyText(String message,
ChatColor defaultColor)
Converts the old formatting system that used
ChatColor.COLOR_CHAR into the new json based
system. |
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(StringBuilder builder) |
protected void |
toPlainText(StringBuilder builder) |
String |
toString() |
addExtra, addExtra, copyFormatting, copyFormatting, copyFormatting, duplicateWithoutFormatting, getClickEvent, getColor, getColorRaw, getExtra, getFont, getFontRaw, getHoverEvent, getInsertion, hasFormatting, isBold, isBoldRaw, isItalic, isItalicRaw, isObfuscated, isObfuscatedRaw, isStrikethrough, isStrikethroughRaw, isUnderlined, isUnderlinedRaw, retain, setBold, setClickEvent, setColor, setExtra, setFont, setHoverEvent, setInsertion, setItalic, setObfuscated, setStrikethrough, setUnderlined, toLegacyText, toLegacyText, toPlainText, toPlainTextpublic TextComponent()
public TextComponent(TextComponent textComponent)
textComponent - the component to copy frompublic TextComponent(BaseComponent... extras)
extras - the extras to setpublic TextComponent(String text)
public static BaseComponent[] fromLegacyText(String message)
ChatColor.COLOR_CHAR into the new json based
system.message - the text to convertpublic static BaseComponent[] fromLegacyText(String message, ChatColor defaultColor)
ChatColor.COLOR_CHAR into the new json based
system.message - the text to convertdefaultColor - color to use when no formatting is to be applied
(i.e. after ChatColor.RESET).public TextComponent duplicate()
duplicate in class BaseComponentprotected void toPlainText(StringBuilder builder)
protected void toLegacyText(StringBuilder builder)
public String toString()
toString in class BaseComponentpublic String getText()
public void setText(String text)
public boolean equals(Object o)
equals in class BaseComponentprotected boolean canEqual(Object other)
canEqual in class BaseComponentpublic int hashCode()
hashCode in class BaseComponentCopyright © 2012–2020 SpigotMC. All rights reserved.