public abstract class BaseComponent extends Object
Constructor and Description |
---|
BaseComponent()
Deprecated.
for use by internal classes only, will be removed.
|
Modifier and Type | Method and Description |
---|---|
void |
addExtra(BaseComponent component)
Appends a component to the component.
|
void |
addExtra(String text)
Appends a text element to the component.
|
protected boolean |
canEqual(Object other) |
void |
copyFormatting(BaseComponent component)
Copies the events and formatting of a BaseComponent.
|
void |
copyFormatting(BaseComponent component,
boolean replace)
Copies the events and formatting of a BaseComponent.
|
void |
copyFormatting(BaseComponent component,
ComponentBuilder.FormatRetention retention,
boolean replace)
Copies the specified formatting of a BaseComponent.
|
abstract BaseComponent |
duplicate()
Clones the BaseComponent and returns the clone.
|
BaseComponent |
duplicateWithoutFormatting()
Deprecated.
API use discouraged, use traditional duplicate
|
boolean |
equals(Object o) |
ClickEvent |
getClickEvent()
The action to perform when this component (and child components) are
clicked
|
ChatColor |
getColor()
Returns the color of this component.
|
ChatColor |
getColorRaw()
Returns the color of this component without checking the parents color.
|
List<BaseComponent> |
getExtra()
Appended components that inherit this component's formatting and events
|
String |
getFont()
Returns the font of this component.
|
String |
getFontRaw()
Returns the font of this component without checking the parents font.
|
HoverEvent |
getHoverEvent()
The action to perform when this component (and child components) are
hovered over
|
String |
getInsertion()
The text to insert into the chat when this component (and child
components) are clicked while pressing the shift key
|
boolean |
hasFormatting()
Returns whether the component has any formatting or events applied to it
|
int |
hashCode() |
boolean |
isBold()
Returns whether this component is bold.
|
Boolean |
isBoldRaw()
Returns whether this component is bold without checking the parents
setting.
|
boolean |
isItalic()
Returns whether this component is italic.
|
Boolean |
isItalicRaw()
Returns whether this component is italic without checking the parents
setting.
|
boolean |
isObfuscated()
Returns whether this component is obfuscated.
|
Boolean |
isObfuscatedRaw()
Returns whether this component is obfuscated without checking the parents
setting.
|
boolean |
isStrikethrough()
Returns whether this component is strikethrough.
|
Boolean |
isStrikethroughRaw()
Returns whether this component is strikethrough without checking the
parents setting.
|
boolean |
isUnderlined()
Returns whether this component is underlined.
|
Boolean |
isUnderlinedRaw()
Returns whether this component is underlined without checking the parents
setting.
|
void |
retain(ComponentBuilder.FormatRetention retention)
Retains only the specified formatting.
|
void |
setBold(Boolean bold)
Whether this component and any child components (unless overridden) is
bold
|
void |
setClickEvent(ClickEvent clickEvent)
The action to perform when this component (and child components) are
clicked
|
void |
setColor(ChatColor color)
The color of this component and any child components (unless overridden)
|
void |
setExtra(List<BaseComponent> components) |
void |
setFont(String font)
The font of this component and any child components (unless overridden)
|
void |
setHoverEvent(HoverEvent hoverEvent)
The action to perform when this component (and child components) are
hovered over
|
void |
setInsertion(String insertion)
The text to insert into the chat when this component (and child
components) are clicked while pressing the shift key
|
void |
setItalic(Boolean italic)
Whether this component and any child components (unless overridden) is
italic
|
void |
setObfuscated(Boolean obfuscated)
Whether this component and any child components (unless overridden) is
obfuscated
|
void |
setStrikethrough(Boolean strikethrough)
Whether this component and any child components (unless overridden) is
strikethrough
|
void |
setUnderlined(Boolean underlined)
Whether this component and any child components (unless overridden) is
underlined
|
String |
toLegacyText()
Converts the component to a string that uses the old formatting codes
(
ChatColor.COLOR_CHAR |
static String |
toLegacyText(BaseComponent... components)
Converts the components to a string that uses the old formatting codes
(
ChatColor.COLOR_CHAR |
String |
toPlainText()
Converts the component into a string without any formatting
|
static String |
toPlainText(BaseComponent... components)
Converts the components into a string without any formatting
|
String |
toString() |
@Deprecated public BaseComponent()
public void copyFormatting(BaseComponent component)
component
- the component to copy frompublic void copyFormatting(BaseComponent component, boolean replace)
component
- the component to copy fromreplace
- if already set formatting should be replaced by the new
componentpublic void copyFormatting(BaseComponent component, ComponentBuilder.FormatRetention retention, boolean replace)
component
- the component to copy fromretention
- the formatting to copyreplace
- if already set formatting should be replaced by the new
componentpublic void retain(ComponentBuilder.FormatRetention retention)
retention
- the formatting to retainpublic abstract BaseComponent duplicate()
@Deprecated public BaseComponent duplicateWithoutFormatting()
public static String toLegacyText(BaseComponent... components)
ChatColor.COLOR_CHAR
components
- the components to convertpublic static String toPlainText(BaseComponent... components)
components
- the components to convertpublic ChatColor getColor()
ChatColor.WHITE
is returned if no color is found.public ChatColor getColorRaw()
public String getFont()
public String getFontRaw()
public boolean isBold()
public Boolean isBoldRaw()
public boolean isItalic()
public Boolean isItalicRaw()
public boolean isUnderlined()
public Boolean isUnderlinedRaw()
public boolean isStrikethrough()
public Boolean isStrikethroughRaw()
public boolean isObfuscated()
public Boolean isObfuscatedRaw()
public void setExtra(List<BaseComponent> components)
public void addExtra(String text)
text
- the text to appendpublic void addExtra(BaseComponent component)
component
- the component to appendpublic boolean hasFormatting()
public String toPlainText()
public String toLegacyText()
ChatColor.COLOR_CHAR
public void setColor(ChatColor color)
public void setFont(String font)
public void setBold(Boolean bold)
public void setItalic(Boolean italic)
public void setUnderlined(Boolean underlined)
public void setStrikethrough(Boolean strikethrough)
public void setObfuscated(Boolean obfuscated)
public void setInsertion(String insertion)
public void setClickEvent(ClickEvent clickEvent)
public void setHoverEvent(HoverEvent hoverEvent)
protected boolean canEqual(Object other)
public String getInsertion()
public List<BaseComponent> getExtra()
public ClickEvent getClickEvent()
public HoverEvent getHoverEvent()
Copyright © 2012–2020 SpigotMC. All rights reserved.