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 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

      @NotNull @NotNull ObjectiveRenderType renderType()
      Returns:
      the render type of the objective, defaults to ObjectiveRenderType.INTEGER
    • renderType

      @NotNull @NotNull ScoreboardObjective renderType(@NotNull @NotNull ObjectiveRenderType renderType)
      Sets the render type of the objective.
      Parameters:
      renderType - new render type
    • defaultScoreFormat

      @Nullable @Nullable ScoreFormat defaultScoreFormat()
      Returns:
      the default score format for all scores in this objective, defaults to null
    • defaultScoreFormat

      void defaultScoreFormat(@Nullable @Nullable ScoreFormat defaultScoreFormat)
      Sets the default score format of this objective.
      Parameters:
      defaultScoreFormat - new default score format
      See Also:
    • scoreInfo

      @Nullable @Nullable ObjectiveScore scoreInfo(@NotNull @NotNull String entry)
      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 @Nullable default @Nullable Integer score(@NotNull @NotNull String entry)
      Deprecated.
      Gets 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

      @NotNull @NotNull ScoreboardObjective score(@NotNull @NotNull String entry, ObjectiveScore score)
      Updates the score of an entry.
      Parameters:
      entry - entry to update score of
      score - score
    • score

      @NotNull default @NotNull ScoreboardObjective score(@NotNull @NotNull String entry, int scoreValue)
      Updates the score of an entry.
      Parameters:
      entry - entry to update score of
      scoreValue - 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 of
      scoreValue - score value
      displayName - score display name
      scoreFormat - 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 of
      scoreValue - score value
      displayName - 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 of
      scoreValue - score value
      scoreFormat - score format
    • removeScore

      @NotNull @NotNull ScoreboardObjective removeScore(@NotNull @NotNull String entry)
      Removes a score associated with an entry.
      Parameters:
      entry - entry to remove score of