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.
|
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
|
ChatColor |
getColor()
Returns the color of this component.
|
ChatColor |
getColorRaw()
Returns the color of this component without checking the parents color.
|
String |
getFont()
Returns the font of this component.
|
String |
getFontRaw()
Returns the font of this component without checking the parents font.
|
boolean |
hasFormatting()
Returns whether the component has any formatting or events applied to it
|
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 |
setExtra(List<BaseComponent> components) |
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
|
@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
Copyright © 2012–2020 SpigotMC. All rights reserved.