Package net.kyori.adventure.text
Interface ScoreComponent
-
- All Superinterfaces:
Buildable<ScoreComponent,ScoreComponent.Builder>,BuildableComponent<ScoreComponent,ScoreComponent.Builder>,Component,ComponentBuilderApplicable,ComponentLike,net.kyori.examination.Examinable,HoverEventSource<Component>,ScopedComponent<ScoreComponent>
public interface ScoreComponent extends BuildableComponent<ScoreComponent,ScoreComponent.Builder>, ScopedComponent<ScoreComponent>
A component that can display a player's score from a scoreboard objective, with an optional fallback value if the search for the score fails.This component consists of:
- name
- a player username or a Minecraft selector that leads to a single player
- objective
- a scoreboard objective
- value(optional)
- a fallback value to be used if the search fails.
This field is no longer present in the game from 1.16, which means it will be ignored
This component is rendered serverside and can therefore receive platform-defined context. See the documentation for your respective platform for more info
- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceScoreComponent.BuilderA score component builder.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull Stringname()Gets the score name.@NonNull ScoreComponentname(@NonNull String name)Sets the score name.@NonNull Stringobjective()Gets the objective name.@NonNull ScoreComponentobjective(@NonNull String objective)Sets the score objective.@Nullable Stringvalue()Gets the value.@NonNull ScoreComponentvalue(@Nullable String value)Sets the value.-
Methods inherited from interface net.kyori.adventure.text.BuildableComponent
toBuilder
-
Methods inherited from interface net.kyori.adventure.text.Component
asComponent, asHoverEvent, children, clickEvent, color, componentBuilderApply, contains, decoration, decorations, decorations, detectCycle, hasDecoration, hasStyling, hoverEvent, insertion, replaceFirstText, replaceFirstText, replaceText, replaceText, replaceText, replaceText, replaceText, replaceText, replaceText, replaceText, style, style
-
Methods inherited from interface net.kyori.examination.Examinable
examinableName, examinableProperties, examine
-
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
-
Methods inherited from interface net.kyori.adventure.text.ScopedComponent
append, append, append, children, clickEvent, color, colorIfAbsent, decorate, decoration, decoration, hoverEvent, insertion, mergeStyle, mergeStyle, mergeStyle, style, style, style
-
-
-
-
Method Detail
-
name
@NonNull String name()
Gets the score name.- Returns:
- the score name
- Since:
- 4.0.0
-
name
@Contract(pure=true) @NonNull ScoreComponent name(@NonNull String name)
Sets the score name.- Parameters:
name- the score name- Returns:
- a score component
- Since:
- 4.0.0
-
objective
@NonNull String objective()
Gets the objective name.- Returns:
- the objective name
- Since:
- 4.0.0
-
objective
@Contract(pure=true) @NonNull ScoreComponent objective(@NonNull String objective)
Sets the score objective.- Parameters:
objective- the score objective- Returns:
- a score component
- Since:
- 4.0.0
-
value
@Nullable String value()
Gets the value.- Returns:
- the value
- Since:
- 4.0.0
-
value
@Contract(pure=true) @NonNull ScoreComponent value(@Nullable String value)
Sets the value.- Parameters:
value- the value- Returns:
- a score component
- Since:
- 4.0.0
-
-