public abstract static class Text.Builder extends Object implements TextRepresentable
Text
instances.Text
Modifier and Type | Method and Description |
---|---|
Text.Builder |
append(Collection<? extends Text> children)
Appends the specified
Text to the end of this text. |
Text.Builder |
append(Iterable<? extends Text> children)
Appends the specified
Text to the end of this text. |
Text.Builder |
append(Iterator<? extends Text> children)
Appends the specified
Text to the end of this text. |
Text.Builder |
append(Text... children)
Appends the specified
Text to the end of this text. |
abstract Text |
build()
Builds an immutable instance of the current state of this text
builder.
|
Text.Builder |
color(TextColor color)
Sets the
TextColor of this text. |
boolean |
equals(Object o) |
Text.Builder |
format(TextFormat format)
Sets the
TextFormat of this text. |
List<Text> |
getChildren()
Returns a view of the current children of this builder.
|
Optional<ClickAction<?>> |
getClickAction()
Returns the current
ClickAction of this builder. |
TextColor |
getColor()
Returns the current color of the
Text in this builder. |
TextFormat |
getFormat()
Returns the current format of the
Text in this builder. |
Optional<HoverAction<?>> |
getHoverAction()
Returns the current
HoverAction of this builder. |
Optional<ShiftClickAction<?>> |
getShiftClickAction()
Returns the current
ShiftClickAction of this builder. |
TextStyle |
getStyle()
Returns the current style of the
Text in this builder. |
int |
hashCode() |
Text.Builder |
insert(int pos,
Collection<? extends Text> children)
Inserts the specified
Text at the given position of this
builder. |
Text.Builder |
insert(int pos,
Iterable<? extends Text> children)
Inserts the specified
Text at the given position of this
builder. |
Text.Builder |
insert(int pos,
Iterator<? extends Text> children)
Inserts the specified
Text at the given position of this
builder. |
Text.Builder |
insert(int pos,
Text... children)
Inserts the specified
Text at the given position of this
builder. |
Text.Builder |
onClick(ClickAction<?> clickAction)
Sets the
ClickAction that will be executed if the text is
clicked in the chat. |
Text.Builder |
onHover(HoverAction<?> hoverAction)
Sets the
HoverAction that will be executed if the text is
hovered in the chat. |
Text.Builder |
onShiftClick(ShiftClickAction<?> shiftClickAction)
Sets the
ShiftClickAction that will be executed if the text
is shift-clicked in the chat. |
Text.Builder |
remove(Collection<? extends Text> children)
Removes the specified
Text from this builder. |
Text.Builder |
remove(int index)
Removes the child at the given index.
|
Text.Builder |
remove(Iterable<? extends Text> children)
Removes the specified
Text from this builder. |
Text.Builder |
remove(Iterator<? extends Text> children)
Removes the specified
Text from this builder. |
Text.Builder |
remove(Text... children)
Removes the specified
Text from this builder. |
Text.Builder |
removeAll()
Removes all children from this builder.
|
Text.Builder |
removeLastChild()
Removes the last child in this builder.
|
Text.Builder |
style(TextStyle... styles)
Sets the text styles of this text.
|
String |
toString() |
Text |
toText()
Gets the textual representation of this instance for its usage in other
Text objects. |
Text.Builder |
trim()
Removes all empty texts from the beginning and end of this
builder.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
applyTo
public final TextFormat getFormat()
Text
in this builder.Text.getFormat()
public Text.Builder format(TextFormat format)
TextFormat
of this text.format
- The new text format for this textText.getFormat()
public final TextColor getColor()
Text
in this builder.Text.getColor()
public Text.Builder color(TextColor color)
TextColor
of this text.color
- The new text color for this textText.getColor()
public final TextStyle getStyle()
Text
in this builder.Text.getStyle()
public Text.Builder style(TextStyle... styles)
TextStyle
of the current style and the specified styles first
and set it to the text.styles
- The text styles to applyText.getStyle()
public final Optional<ClickAction<?>> getClickAction()
ClickAction
of this builder.Optional.empty()
if noneText.getClickAction()
public Text.Builder onClick(@Nullable ClickAction<?> clickAction)
ClickAction
that will be executed if the text is
clicked in the chat.clickAction
- The new click action for the textText.getClickAction()
public final Optional<HoverAction<?>> getHoverAction()
HoverAction
of this builder.Optional.empty()
if noneText.getHoverAction()
public Text.Builder onHover(@Nullable HoverAction<?> hoverAction)
HoverAction
that will be executed if the text is
hovered in the chat.hoverAction
- The new hover action for the textText.getHoverAction()
public final Optional<ShiftClickAction<?>> getShiftClickAction()
ShiftClickAction
of this builder.Optional.empty()
if
noneText.getShiftClickAction()
public Text.Builder onShiftClick(@Nullable ShiftClickAction<?> shiftClickAction)
ShiftClickAction
that will be executed if the text
is shift-clicked in the chat.shiftClickAction
- The new shift click action for the textText.getShiftClickAction()
public final List<Text> getChildren()
The returned list is unmodifiable, but not immutable. It will change if new children get added through this builder.
Text.getChildren()
public Text.Builder append(Text... children)
Text
to the end of this text.children
- The texts to appendText.getChildren()
public Text.Builder append(Collection<? extends Text> children)
Text
to the end of this text.children
- The texts to appendText.getChildren()
public Text.Builder append(Iterable<? extends Text> children)
Text
to the end of this text.children
- The texts to appendText.getChildren()
public Text.Builder append(Iterator<? extends Text> children)
Text
to the end of this text.children
- The texts to appendText.getChildren()
public Text.Builder insert(int pos, Text... children)
Text
at the given position of this
builder.pos
- The position to insert the texts tochildren
- The texts to insertIndexOutOfBoundsException
- If the position is out of boundsText.getChildren()
public Text.Builder insert(int pos, Collection<? extends Text> children)
Text
at the given position of this
builder.pos
- The position to insert the texts tochildren
- The texts to insertIndexOutOfBoundsException
- If the position is out of rangeText.getChildren()
public Text.Builder insert(int pos, Iterable<? extends Text> children)
Text
at the given position of this
builder.pos
- The position to insert the texts tochildren
- The texts to insertIndexOutOfBoundsException
- If the position is out of rangeText.getChildren()
public Text.Builder insert(int pos, Iterator<? extends Text> children)
Text
at the given position of this
builder.pos
- The position to insert the texts tochildren
- The texts to insertIndexOutOfBoundsException
- If the position is out of rangeText.getChildren()
public Text.Builder removeLastChild()
remove(int)
public Text.Builder remove(int index)
index
- The index of the childIndexOutOfBoundsException
- if the given index is out of boundspublic Text.Builder remove(Text... children)
Text
from this builder.children
- The texts to removeText.getChildren()
public Text.Builder remove(Collection<? extends Text> children)
Text
from this builder.children
- The texts to removeText.getChildren()
public Text.Builder remove(Iterable<? extends Text> children)
Text
from this builder.children
- The texts to removeText.getChildren()
public Text.Builder remove(Iterator<? extends Text> children)
Text
from this builder.children
- The texts to removeText.getChildren()
public Text.Builder removeAll()
Text.getChildren()
public Text.Builder trim()
public abstract Text build()
Text
with the current properties of this
builderpublic final Text toText()
TextRepresentable
Text
objects. This may but does not need to include
hover texts
or other actions
. This
method is basically the toString()
equivalent
for Text
s.toText
in interface TextRepresentable