Interface ScoreboardObjective
- All Known Implementing Classes:
NoopScoreboardObjective
public interface ScoreboardObjective
Represents a scoreboard objective.
To get an instance of this interface, use
ObjectiveManager.create(java.lang.String).
Note: this interface is not thread-safe, meaning you can only use it from one thread at a time,
although it does not have to be the main thread.-
Method Summary
Modifier and TypeMethodDescription@Nullable ScoreFormatvoiddefaultScoreFormat(@Nullable ScoreFormat defaultScoreFormat) Sets the default score format of this objective.@NotNull ScoreboardObjectiveremoveScore(@NotNull String entry) Removes a score associated with an entry.@NotNull ObjectiveRenderType@NotNull ScoreboardObjectiverenderType(@NotNull ObjectiveRenderType renderType) Sets the render type of the objective.default @Nullable IntegerDeprecated.default @NotNull ScoreboardObjectiveUpdates the score of an entry.default @NotNull ScoreboardObjectivescore(@NotNull String entry, int scoreValue, @Nullable net.kyori.adventure.text.ComponentLike displayName) Updates the score of an entry.default @NotNull ScoreboardObjectivescore(@NotNull String entry, int scoreValue, @Nullable net.kyori.adventure.text.ComponentLike displayName, @Nullable ScoreFormat scoreFormat) Updates the score of an entry.default @NotNull ScoreboardObjectivescore(@NotNull String entry, int scoreValue, @Nullable ScoreFormat scoreFormat) Updates the score of an entry.@NotNull ScoreboardObjectivescore(@NotNull String entry, ObjectiveScore score) Updates the score of an entry.@Nullable ObjectiveScoreGet the score for an entry, or null if the entry has no score.@NotNull net.kyori.adventure.text.Componentvalue()@NotNull ScoreboardObjectivevalue(@NotNull net.kyori.adventure.text.ComponentLike value) Sets the value (display name) of the objective.
-
Method Details
-
value
@NotNull @NotNull net.kyori.adventure.text.Component value()- Returns:
- the value (display name) of the objective, defaults to
Component.empty()
-
value
@NotNull @NotNull ScoreboardObjective value(@NotNull @NotNull net.kyori.adventure.text.ComponentLike value) Sets the value (display name) of the objective.- Parameters:
value- new value
-
renderType
- Returns:
- the render type of the objective, defaults to
ObjectiveRenderType.INTEGER
-
renderType
Sets the render type of the objective.- Parameters:
renderType- new render type
-
defaultScoreFormat
- Returns:
- the default score format for all scores in this objective, defaults to null
-
defaultScoreFormat
Sets the default score format of this objective.- Parameters:
defaultScoreFormat- new default score format- See Also:
-
scoreInfo
Get the score for an entry, or null if the entry has no score.- Parameters:
entry- entry to get score of- Returns:
- the score value, or null if it doesn't exist for the entry
-
score
Deprecated.usescoreInfo(String)andObjectiveScore.value()insteadGets the score value for an entry, or null if the entry has no score.- Parameters:
entry- entry to get score of- Returns:
- the score value, or null if it doesn't exist for the entry
-
score
Updates the score of an entry.- Parameters:
entry- entry to update score ofscore- score
-
score
Updates the score of an entry.- Parameters:
entry- entry to update score ofscoreValue- score value
-
score
@NotNull default @NotNull ScoreboardObjective score(@NotNull @NotNull String entry, int scoreValue, @Nullable @Nullable net.kyori.adventure.text.ComponentLike displayName, @Nullable @Nullable ScoreFormat scoreFormat) Updates the score of an entry.- Parameters:
entry- entry to update score ofscoreValue- score valuedisplayName- score display namescoreFormat- score format
-
score
@NotNull default @NotNull ScoreboardObjective score(@NotNull @NotNull String entry, int scoreValue, @Nullable @Nullable net.kyori.adventure.text.ComponentLike displayName) Updates the score of an entry.- Parameters:
entry- entry to update score ofscoreValue- score valuedisplayName- score display name
-
score
@NotNull default @NotNull ScoreboardObjective score(@NotNull @NotNull String entry, int scoreValue, @Nullable @Nullable ScoreFormat scoreFormat) Updates the score of an entry.- Parameters:
entry- entry to update score ofscoreValue- score valuescoreFormat- score format
-
removeScore
Removes a score associated with an entry.- Parameters:
entry- entry to remove score of
-
scoreInfo(String)andObjectiveScore.value()instead