public static class TranslatableText.Builder extends Text.Builder
Text.Builder
creating immutable
TranslatableText
instances.TranslatableText
Modifier and Type | Method and Description |
---|---|
TranslatableText.Builder |
append(Collection<? extends Text> children)
Appends the specified
Text to the end of this text. |
TranslatableText.Builder |
append(Iterable<? extends Text> children)
Appends the specified
Text to the end of this text. |
TranslatableText.Builder |
append(Iterator<? extends Text> children)
Appends the specified
Text to the end of this text. |
TranslatableText.Builder |
append(Text... children)
Appends the specified
Text to the end of this text. |
TranslatableText |
build()
Builds an immutable instance of the current state of this text
builder.
|
TranslatableText.Builder |
color(TextColor color)
Sets the
TextColor of this text. |
boolean |
equals(Object o) |
TranslatableText.Builder |
format(TextFormat format)
Sets the
TextFormat of this text. |
ImmutableList<Object> |
getArguments()
Returns the current translation arguments of this builder.
|
Translation |
getTranslation()
Returns the current translation of this builder.
|
int |
hashCode() |
TranslatableText.Builder |
insert(int pos,
Collection<? extends Text> children)
Inserts the specified
Text at the given position of this
builder. |
TranslatableText.Builder |
insert(int pos,
Iterable<? extends Text> children)
Inserts the specified
Text at the given position of this
builder. |
TranslatableText.Builder |
insert(int pos,
Iterator<? extends Text> children)
Inserts the specified
Text at the given position of this
builder. |
TranslatableText.Builder |
insert(int pos,
Text... children)
Inserts the specified
Text at the given position of this
builder. |
TranslatableText.Builder |
onClick(ClickAction<?> clickAction)
Sets the
ClickAction that will be executed if the text is
clicked in the chat. |
TranslatableText.Builder |
onHover(HoverAction<?> hoverAction)
Sets the
HoverAction that will be executed if the text is
hovered in the chat. |
TranslatableText.Builder |
onShiftClick(ShiftClickAction<?> shiftClickAction)
Sets the
ShiftClickAction that will be executed if the text
is shift-clicked in the chat. |
TranslatableText.Builder |
remove(Collection<? extends Text> children)
Removes the specified
Text from this builder. |
TranslatableText.Builder |
remove(Iterable<? extends Text> children)
Removes the specified
Text from this builder. |
TranslatableText.Builder |
remove(Iterator<? extends Text> children)
Removes the specified
Text from this builder. |
TranslatableText.Builder |
remove(Text... children)
Removes the specified
Text from this builder. |
TranslatableText.Builder |
removeAll()
Removes all children from this builder.
|
TranslatableText.Builder |
style(TextStyle... styles)
Sets the text styles of this text.
|
TranslatableText.Builder |
translation(Translatable translatable,
Object... args)
Sets the translation of the text.
|
TranslatableText.Builder |
translation(Translation translation,
Object... args)
Sets the translation of the text.
|
getChildren, getClickAction, getColor, getFormat, getHoverAction, getShiftClickAction, getStyle, remove, removeLastChild, toString, toText, trim
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
applyTo
public final Translation getTranslation()
TranslatableText.getTranslation()
public final ImmutableList<Object> getArguments()
TranslatableText.getArguments()
public TranslatableText.Builder translation(Translation translation, Object... args)
translation
- The translation to use for this builderargs
- The arguments for the translationpublic TranslatableText.Builder translation(Translatable translatable, Object... args)
translatable
- The translatable object to use for this builderargs
- The arguments for the translationpublic TranslatableText build()
Text.Builder
build
in class Text.Builder
Text
with the current properties of this
builderpublic boolean equals(@Nullable Object o)
equals
in class Text.Builder
public int hashCode()
hashCode
in class Text.Builder
public TranslatableText.Builder format(TextFormat format)
Text.Builder
TextFormat
of this text.format
in class Text.Builder
format
- The new text format for this textText.getFormat()
public TranslatableText.Builder color(TextColor color)
Text.Builder
TextColor
of this text.color
in class Text.Builder
color
- The new text color for this textText.getColor()
public TranslatableText.Builder style(TextStyle... styles)
Text.Builder
TextStyle
of the current style and the specified styles first
and set it to the text.style
in class Text.Builder
styles
- The text styles to applyText.getStyle()
public TranslatableText.Builder onClick(@Nullable ClickAction<?> clickAction)
Text.Builder
ClickAction
that will be executed if the text is
clicked in the chat.onClick
in class Text.Builder
clickAction
- The new click action for the textText.getClickAction()
public TranslatableText.Builder onHover(@Nullable HoverAction<?> hoverAction)
Text.Builder
HoverAction
that will be executed if the text is
hovered in the chat.onHover
in class Text.Builder
hoverAction
- The new hover action for the textText.getHoverAction()
public TranslatableText.Builder onShiftClick(@Nullable ShiftClickAction<?> shiftClickAction)
Text.Builder
ShiftClickAction
that will be executed if the text
is shift-clicked in the chat.onShiftClick
in class Text.Builder
shiftClickAction
- The new shift click action for the textText.getShiftClickAction()
public TranslatableText.Builder append(Text... children)
Text.Builder
Text
to the end of this text.append
in class Text.Builder
children
- The texts to appendText.getChildren()
public TranslatableText.Builder append(Collection<? extends Text> children)
Text.Builder
Text
to the end of this text.append
in class Text.Builder
children
- The texts to appendText.getChildren()
public TranslatableText.Builder append(Iterable<? extends Text> children)
Text.Builder
Text
to the end of this text.append
in class Text.Builder
children
- The texts to appendText.getChildren()
public TranslatableText.Builder append(Iterator<? extends Text> children)
Text.Builder
Text
to the end of this text.append
in class Text.Builder
children
- The texts to appendText.getChildren()
public TranslatableText.Builder insert(int pos, Text... children)
Text.Builder
Text
at the given position of this
builder.insert
in class Text.Builder
pos
- The position to insert the texts tochildren
- The texts to insertText.getChildren()
public TranslatableText.Builder insert(int pos, Collection<? extends Text> children)
Text.Builder
Text
at the given position of this
builder.insert
in class Text.Builder
pos
- The position to insert the texts tochildren
- The texts to insertText.getChildren()
public TranslatableText.Builder insert(int pos, Iterable<? extends Text> children)
Text.Builder
Text
at the given position of this
builder.insert
in class Text.Builder
pos
- The position to insert the texts tochildren
- The texts to insertText.getChildren()
public TranslatableText.Builder insert(int pos, Iterator<? extends Text> children)
Text.Builder
Text
at the given position of this
builder.insert
in class Text.Builder
pos
- The position to insert the texts tochildren
- The texts to insertText.getChildren()
public TranslatableText.Builder remove(Text... children)
Text.Builder
Text
from this builder.remove
in class Text.Builder
children
- The texts to removeText.getChildren()
public TranslatableText.Builder remove(Collection<? extends Text> children)
Text.Builder
Text
from this builder.remove
in class Text.Builder
children
- The texts to removeText.getChildren()
public TranslatableText.Builder remove(Iterable<? extends Text> children)
Text.Builder
Text
from this builder.remove
in class Text.Builder
children
- The texts to removeText.getChildren()
public TranslatableText.Builder remove(Iterator<? extends Text> children)
Text.Builder
Text
from this builder.remove
in class Text.Builder
children
- The texts to removeText.getChildren()
public TranslatableText.Builder removeAll()
Text.Builder
removeAll
in class Text.Builder
Text.getChildren()