Modifier and Type | Class and Description |
---|---|
static class |
Style.Serializer
A JSON serializer for
Style . |
Modifier and Type | Field and Description |
---|---|
private Boolean |
bold |
private ClickEvent |
clickEvent |
private TextColor |
color |
static Identifier |
DEFAULT_FONT_ID
The identifier for the default font of a style.
|
static Style |
EMPTY
An empty style.
|
private Identifier |
font |
private HoverEvent |
hoverEvent |
private String |
insertion |
private Boolean |
italic |
private Boolean |
obfuscated |
private Boolean |
strikethrough |
private Boolean |
underlined |
Modifier | Constructor and Description |
---|---|
private |
Style(TextColor color,
Boolean bold,
Boolean italic,
Boolean underlined,
Boolean strikethrough,
Boolean obfuscated,
ClickEvent clickEvent,
HoverEvent hoverEvent,
String insertion,
Identifier font) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
ClickEvent |
getClickEvent()
Returns the click event of this style.
|
TextColor |
getColor()
Returns the color of this style.
|
Identifier |
getFont()
Returns the font of this style.
|
HoverEvent |
getHoverEvent()
Returns the hover event of this style.
|
String |
getInsertion()
Returns the insertion text of the style.
|
int |
hashCode() |
boolean |
isBold()
Returns whether the style has bold formatting.
|
boolean |
isEmpty()
Returns if this is the empty style.
|
boolean |
isItalic()
Returns whether the style has italic formatting.
|
boolean |
isObfuscated()
Returns whether the style has obfuscated formatting.
|
boolean |
isStrikethrough()
Returns whether the style has strikethrough formatting.
|
boolean |
isUnderlined()
Returns whether the style has underline formatting.
|
String |
toString() |
Style |
withBold(Boolean bold)
Returns a new style with the bold attribute provided and all other
attributes of this style.
|
Style |
withClickEvent(ClickEvent clickEvent)
Returns a new style with the click event provided and all other
attributes of this style.
|
Style |
withColor(Formatting color)
Returns a new style with the color provided and all other attributes of
this style.
|
Style |
withColor(TextColor color)
Returns a new style with the color provided and all other attributes of
this style.
|
Style |
withExclusiveFormatting(Formatting formatting)
Returns a new style with the formatting provided and some applicable
attributes of this style.
|
Style |
withFont(Identifier font)
Returns a new style with the font provided and all other
attributes of this style.
|
Style |
withFormatting(Formatting formatting)
Returns a new style with the formatting provided and all other
attributes of this style.
|
Style |
withFormatting(Formatting[] formattings)
Returns a new style with the formattings provided and all other
attributes of this style.
|
Style |
withHoverEvent(HoverEvent hoverEvent)
Returns a new style with the hover event provided and all other
attributes of this style.
|
Style |
withInsertion(String insertion)
Returns a new style with the insertion provided and all other
attributes of this style.
|
Style |
withItalic(Boolean italic)
Returns a new style with the italic attribute provided and all other
attributes of this style.
|
Style |
withParent(Style parent)
Returns a new style with the undefined attributes of this style filled
by the
parent style. |
Style |
withUnderline(Boolean underline)
Returns a new style with the underline attribute provided and all other
attributes of this style.
|
public static final Style EMPTY
public static final Identifier DEFAULT_FONT_ID
@Nullable private final ClickEvent clickEvent
@Nullable private final HoverEvent hoverEvent
@Nullable private final Identifier font
private Style(@Nullable TextColor color, @Nullable Boolean bold, @Nullable Boolean italic, @Nullable Boolean underlined, @Nullable Boolean strikethrough, @Nullable Boolean obfuscated, @Nullable ClickEvent clickEvent, @Nullable HoverEvent hoverEvent, @Nullable String insertion, @Nullable Identifier font)
public boolean isBold()
Formatting.BOLD
public boolean isItalic()
Formatting.ITALIC
public boolean isStrikethrough()
Formatting.STRIKETHROUGH
public boolean isUnderlined()
Formatting.UNDERLINE
public boolean isObfuscated()
Formatting.OBFUSCATED
public boolean isEmpty()
EMPTY
@Nullable public ClickEvent getClickEvent()
@Nullable public HoverEvent getHoverEvent()
@Nullable public String getInsertion()
An insertion is inserted when a piece of text clicked while shift key is down in the chat HUD.
public Identifier getFont()
public Style withColor(@Nullable TextColor color)
color
- the new colorpublic Style withColor(@Nullable Formatting color)
color
- the new colorpublic Style withBold(@Nullable Boolean bold)
bold
- the new bold propertypublic Style withItalic(@Nullable Boolean italic)
italic
- the new italic property@Environment(value=CLIENT) public Style withUnderline(@Nullable Boolean underline)
public Style withClickEvent(@Nullable ClickEvent clickEvent)
clickEvent
- the new click eventpublic Style withHoverEvent(@Nullable HoverEvent hoverEvent)
hoverEvent
- the new hover eventpublic Style withInsertion(@Nullable String insertion)
insertion
- the new insertion string@Environment(value=CLIENT) public Style withFont(@Nullable Identifier font)
font
- the new fontpublic Style withFormatting(Formatting formatting)
formatting
- the new formatting@Environment(value=CLIENT) public Style withExclusiveFormatting(Formatting formatting)
When a color formatting is passed for formatting
, the other
formattings, including bold, italic, strikethrough, underlined, and
obfuscated, are all removed.
formatting
- the new formattingpublic Style withFormatting(Formatting[] formattings)
formattings
- an array of new formattingspublic Style withParent(Style parent)
parent
style.parent
- the parent style