public class TranslatableComponent extends AbstractBuildableComponent<TranslatableComponent,TranslatableComponent.Builder>
| Modifier and Type | Class and Description |
|---|---|
static class |
TranslatableComponent.Builder
A text component builder.
|
AbstractBuildableComponent.AbstractBuilder<C extends BuildableComponent<C,B>,B extends AbstractBuildableComponent.AbstractBuilder<C,B>>bold, children, clickEvent, color, hoverEvent, insertion, italic, obfuscated, strikethrough, underlinedEMPTY_COMPONENT_LIST| Modifier | Constructor and Description |
|---|---|
protected |
TranslatableComponent(@NonNull java.util.List<Component> children,
@Nullable TextColor color,
TextDecoration.State obfuscated,
TextDecoration.State bold,
TextDecoration.State strikethrough,
TextDecoration.State underlined,
TextDecoration.State italic,
@Nullable ClickEvent clickEvent,
@Nullable HoverEvent hoverEvent,
@Nullable java.lang.String insertion,
@NonNull java.lang.String key,
@NonNull java.util.List<Component> args) |
protected |
TranslatableComponent(@NonNull TranslatableComponent.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
@NonNull TranslatableComponent |
append(@NonNull Component component)
Appends a component to this component.
|
@NonNull java.util.List<Component> |
args()
Gets the unmodifiable list of translation arguments.
|
@NonNull TranslatableComponent |
args(@NonNull java.util.List<Component> args)
Sets the translation arguments for this component.
|
static TranslatableComponent.Builder |
builder()
Creates a translatable component builder.
|
static TranslatableComponent.Builder |
builder(@NonNull java.lang.String key)
Creates a translatable component builder with a translation key.
|
@NonNull TranslatableComponent |
clickEvent(@Nullable ClickEvent event)
Sets the click event of this component.
|
@NonNull TranslatableComponent |
color(@Nullable TextColor color)
Sets the color of this component.
|
@NonNull TranslatableComponent |
copy()
Creates a component.
|
@NonNull TranslatableComponent |
decoration(@NonNull TextDecoration decoration,
boolean flag)
Sets the state of a decoration on this component.
|
@NonNull TranslatableComponent |
decoration(@NonNull TextDecoration decoration,
TextDecoration.State state)
Sets the value of a decoration on this component.
|
boolean |
equals(@Nullable java.lang.Object other) |
int |
hashCode() |
@NonNull TranslatableComponent |
hoverEvent(@Nullable HoverEvent event)
Sets the hover event of this component.
|
@NonNull TranslatableComponent |
insertion(@Nullable java.lang.String insertion)
Sets the string to be inserted when this component is shift-clicked.
|
@NonNull java.lang.String |
key()
Gets the translation key.
|
@NonNull TranslatableComponent |
key(@NonNull java.lang.String key)
Sets the translation key.
|
static TranslatableComponent |
make(@NonNull java.util.function.Consumer<TranslatableComponent.Builder> consumer)
Creates a translatable component by applying configuration from
consumer. |
static TranslatableComponent |
make(@NonNull java.lang.String key,
@NonNull java.util.function.Consumer<TranslatableComponent.Builder> consumer)
Creates a translatable component by applying configuration from
consumer. |
static TranslatableComponent |
make(@NonNull java.lang.String key,
@NonNull java.util.List<Component> args,
@NonNull java.util.function.Consumer<TranslatableComponent.Builder> consumer)
Creates a translatable component by applying configuration from
consumer. |
@NonNull TranslatableComponent |
mergeColor(@NonNull Component that)
Merges the color from another component into this component.
|
@NonNull TranslatableComponent |
mergeDecorations(@NonNull Component that)
Merges the decorations from another component into this component.
|
@NonNull TranslatableComponent |
mergeEvents(@NonNull Component that)
Merges the events from another component into this component.
|
@NonNull TranslatableComponent |
mergeStyle(@NonNull Component that)
Merges styling from another component into this component.
|
static TranslatableComponent |
of(@NonNull java.lang.String key)
Creates a translatable component with a translation key.
|
static TranslatableComponent |
of(@NonNull java.lang.String key,
Component... args)
Creates a translatable component with a translation key and arguments.
|
static TranslatableComponent |
of(@NonNull java.lang.String key,
@NonNull java.util.List<Component> args)
Creates a translatable component with a translation key and arguments.
|
static TranslatableComponent |
of(@NonNull java.lang.String key,
@Nullable TextColor color)
Creates a translatable component with a translation key.
|
static TranslatableComponent |
of(@NonNull java.lang.String key,
@Nullable TextColor color,
Component... args)
Creates a translatable component with a translation key and arguments.
|
static TranslatableComponent |
of(@NonNull java.lang.String key,
@Nullable TextColor color,
@NonNull java.util.List<Component> args)
Creates a translatable component with a translation key and arguments.
|
static TranslatableComponent |
of(@NonNull java.lang.String key,
@Nullable TextColor color,
@NonNull java.util.Set<TextDecoration> decorations)
Creates a translatable component with a translation key.
|
static TranslatableComponent |
of(@NonNull java.lang.String key,
@Nullable TextColor color,
@NonNull java.util.Set<TextDecoration> decorations,
Component... args)
Creates a translatable component with a translation key and arguments.
|
static TranslatableComponent |
of(@NonNull java.lang.String key,
@Nullable TextColor color,
@NonNull java.util.Set<TextDecoration> decorations,
@NonNull java.util.List<Component> args)
Creates a translatable component with a translation key and arguments.
|
protected void |
populateToString(com.google.common.base.MoreObjects.ToStringHelper builder) |
@NonNull TranslatableComponent |
resetStyle()
Resets all styling on this component.
|
@NonNull TranslatableComponent.Builder |
toBuilder()
Create a builder from this component.
|
children, clickEvent, color, decoration, equals, hasStyling, hoverEvent, insertion, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitchildren, clickEvent, color, contains, decoration, decorations, decorations, detectCycle, hasDecoration, hasStyling, hoverEvent, insertion, of, of, of, of, of, ofprotected TranslatableComponent(@NonNull TranslatableComponent.Builder builder)
protected TranslatableComponent(@NonNull java.util.List<Component> children, @Nullable TextColor color, TextDecoration.State obfuscated, TextDecoration.State bold, TextDecoration.State strikethrough, TextDecoration.State underlined, TextDecoration.State italic, @Nullable ClickEvent clickEvent, @Nullable HoverEvent hoverEvent, @Nullable java.lang.String insertion, @NonNull java.lang.String key, @NonNull java.util.List<Component> args)
public static TranslatableComponent.Builder builder()
public static TranslatableComponent.Builder builder(@NonNull java.lang.String key)
key - the translation keypublic static TranslatableComponent of(@NonNull java.lang.String key)
key - the translation keypublic static TranslatableComponent of(@NonNull java.lang.String key, @Nullable TextColor color)
key - the translation keycolor - the colorpublic static TranslatableComponent of(@NonNull java.lang.String key, @Nullable TextColor color, @NonNull java.util.Set<TextDecoration> decorations)
key - the translation keycolor - the colordecorations - the decorationspublic static TranslatableComponent of(@NonNull java.lang.String key, Component... args)
key - the translation keyargs - the translation argumentspublic static TranslatableComponent of(@NonNull java.lang.String key, @Nullable TextColor color, Component... args)
key - the translation keycolor - the colorargs - the translation argumentspublic static TranslatableComponent of(@NonNull java.lang.String key, @Nullable TextColor color, @NonNull java.util.Set<TextDecoration> decorations, Component... args)
key - the translation keycolor - the colordecorations - the decorationsargs - the translation argumentspublic static TranslatableComponent of(@NonNull java.lang.String key, @NonNull java.util.List<Component> args)
key - the translation keyargs - the translation argumentspublic static TranslatableComponent of(@NonNull java.lang.String key, @Nullable TextColor color, @NonNull java.util.List<Component> args)
key - the translation keycolor - the colorargs - the translation argumentspublic static TranslatableComponent of(@NonNull java.lang.String key, @Nullable TextColor color, @NonNull java.util.Set<TextDecoration> decorations, @NonNull java.util.List<Component> args)
key - the translation keycolor - the colordecorations - the decorationsargs - the translation argumentspublic static TranslatableComponent make(@NonNull java.util.function.Consumer<TranslatableComponent.Builder> consumer)
consumer.consumer - the builder configuratorpublic static TranslatableComponent make(@NonNull java.lang.String key, @NonNull java.util.function.Consumer<TranslatableComponent.Builder> consumer)
consumer.key - the translation keyconsumer - the builder configuratorpublic static TranslatableComponent make(@NonNull java.lang.String key, @NonNull java.util.List<Component> args, @NonNull java.util.function.Consumer<TranslatableComponent.Builder> consumer)
consumer.key - the translation keyargs - the translation argumentsconsumer - the builder configuratorpublic @NonNull java.lang.String key()
public @NonNull TranslatableComponent key(@NonNull java.lang.String key)
key - the translation keypublic @NonNull java.util.List<Component> args()
public @NonNull TranslatableComponent args(@NonNull java.util.List<Component> args)
args - the translation argumentspublic @NonNull TranslatableComponent append(@NonNull Component component)
Componentcomponent - the component to appendpublic @NonNull TranslatableComponent color(@Nullable TextColor color)
Componentcolor - the colorpublic @NonNull TranslatableComponent decoration(@NonNull TextDecoration decoration, boolean flag)
Componentdecoration - the decorationflag - true if this component should have the decoration, false if
this component should not have the decorationpublic @NonNull TranslatableComponent decoration(@NonNull TextDecoration decoration, TextDecoration.State state)
Componentdecoration - the decorationstate - TextDecoration.State#TRUE if this component should have the
decoration, TextDecoration.State#FALSE if this component should not
have the decoration, and TextDecoration.State#NOT_SET if the decoration
should not have a set valuepublic @NonNull TranslatableComponent clickEvent(@Nullable ClickEvent event)
Componentevent - the click eventpublic @NonNull TranslatableComponent hoverEvent(@Nullable HoverEvent event)
Componentevent - the hover eventpublic @NonNull TranslatableComponent insertion(@Nullable java.lang.String insertion)
Componentinsertion - the insertion stringpublic @NonNull TranslatableComponent mergeStyle(@NonNull Component that)
Componentthat - the other componentpublic @NonNull TranslatableComponent mergeColor(@NonNull Component that)
Componentthat - the other componentpublic @NonNull TranslatableComponent mergeDecorations(@NonNull Component that)
Componentthat - the other componentpublic @NonNull TranslatableComponent mergeEvents(@NonNull Component that)
Componentthat - the other componentpublic @NonNull TranslatableComponent resetStyle()
Componentpublic @NonNull TranslatableComponent copy()
Componentpublic boolean equals(@Nullable java.lang.Object other)
equals in class AbstractComponentpublic int hashCode()
hashCode in class AbstractComponentprotected void populateToString(com.google.common.base.MoreObjects.ToStringHelper builder)
populateToString in class AbstractComponentpublic @NonNull TranslatableComponent.Builder toBuilder()
BuildableComponent