@minecraft
    正在准备搜索索引...

    类 ScoreboardObjective

    表示记分板上的记分项。包含了分数持有者和各自的分数。

    Contains objectives and participants for the scoreboard.

    索引

    属性

    displayName: string

    此记分项的显示名称。

    Returns the player-visible name of this scoreboard objective.

    若记分项无效,则抛出。

    id: string

    此记分项的名称。

    Identifier of the scoreboard objective.

    若记分项无效,则抛出。

    isValid: boolean

    Returns true if the ScoreboardObjective reference is still valid.

    方法

    • 世界修改

      参数

      • participant: string | Entity | ScoreboardIdentity

        Participant to apply the scoreboard value addition to.

      • scoreToAdd: number

      返回 number

      Adds a score to the given participant and objective.

      This function can throw errors.

    • 参数

      • participant: string | Entity | ScoreboardIdentity

        分数持有者。

        Identifier of the participant to retrieve a score for.

      返回 number

      指定分数持有者的分数。

      获取指定分数持有者的分数。

      Returns a specific score for a participant.

      若此记分项上未记录分数持有者的分数,抛出 "Failed to retrieve score for '<participant>'"。 若记分项无效时,抛出。