Interface ScoreComponent
- All Superinterfaces:
Buildable<ScoreComponent.Builder>, BuildableComponent<ScoreComponent, ScoreComponent.Builder>, Component, ComponentBuilderApplicable, ComponentLike, HoverEventSource<Component>, ScopedComponent<ScoreComponent>, StyleGetter, StyleSetter<Component>
public sealed interface ScoreComponent
extends ScopedComponent<ScoreComponent>, BuildableComponent<ScoreComponent, ScoreComponent.Builder>
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, obsolete)
- a value to use that will override any queried scoreboard value
This field is no longer present in the game from 1.16.5, 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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceA score component builder. -
Field Summary
Fields inherited from interface Component
EQUALS, EQUALS_IDENTITY, IS_NOT_EMPTY -
Method Summary
Methods inherited from interface Component
asHoverEvent, children, clickEvent, color, compact, compact, componentBuilderApply, contains, contains, decoration, decorations, font, hasDecoration, hasStyling, hoverEvent, insertion, iterable, iterable, iterator, iterator, replaceText, replaceText, shadowColor, spliterator, spliterator, styleMethods inherited from interface HoverEventSource
asHoverEventMethods inherited from interface ScopedComponent
append, append, append, append, append, appendNewline, appendSpace, applyFallbackStyle, applyFallbackStyle, asComponent, children, clickEvent, color, colorIfAbsent, decorate, decoration, decoration, decorationIfAbsent, decorations, font, hoverEvent, insertion, mergeStyle, mergeStyle, mergeStyle, shadowColor, shadowColorIfAbsent, style, style, style, styleMethods inherited from interface StyleSetter
decorate, decorations
-
Method Details
-
name
-
name
Sets the score name.- Parameters:
name- the score name- Returns:
- a score component
- Since:
- 4.0.0
-
objective
-
objective
Sets the score objective.- Parameters:
objective- the score objective- Returns:
- a score component
- Since:
- 4.0.0
-
value
Gets the value.- Returns:
- the value
- Since:
- 4.0.0
- Obsolete since Minecraft
- 1.16.5, no longer supported
-
value
Sets the value.- Parameters:
value- the value- Returns:
- a score component
- Since:
- 4.0.0
- Obsolete since Minecraft
- 1.16.5, no longer supported
-
toBuilder
ScoreComponent.Builder toBuilder()Description copied from interface:ComponentReturns a builder for this component.- Specified by:
toBuilderin interfaceBuildable<ScoreComponent.Builder>- Specified by:
toBuilderin interfaceBuildableComponent<ScoreComponent, ScoreComponent.Builder>- Specified by:
toBuilderin interfaceComponent- Specified by:
toBuilderin interfaceScopedComponent<ScoreComponent>- Returns:
- the builder
-