Scoreboard Class

Contains objectives and participants for the scoreboard.

Methods

addObjective

addObjective(objectiveId: string, displayName?: string): ScoreboardObjective

Adds a new objective to the scoreboard.

Parameters

  • objectiveId: string
  • displayName?: string = null

Returns ScoreboardObjective

Important

This function can't be called in read-only mode.

Warning

This function can throw errors.

clearObjectiveAtDisplaySlot

clearObjectiveAtDisplaySlot(displaySlotId: DisplaySlotId): ScoreboardObjective | undefined

Clears the objective that occupies a display slot.

Parameters

Returns ScoreboardObjective | undefined

Important

This function can't be called in read-only mode.

getObjective

getObjective(objectiveId: string): ScoreboardObjective | undefined

Returns a specific objective (by id).

Parameters

  • objectiveId: string

    Identifier of the objective.

Returns ScoreboardObjective | undefined

getObjectiveAtDisplaySlot

getObjectiveAtDisplaySlot(displaySlotId: DisplaySlotId): ScoreboardObjectiveDisplayOptions | undefined

Returns an objective that occupies the specified display slot.

Parameters

Returns ScoreboardObjectiveDisplayOptions | undefined

getObjectives

getObjectives(): ScoreboardObjective[]

Returns all defined objectives.

Returns ScoreboardObjective[]

getParticipants

getParticipants(): ScoreboardIdentity[]

Returns all defined scoreboard identities.

Returns ScoreboardIdentity[]

removeObjective

removeObjective(objectiveId: ScoreboardObjective | string): boolean

Removes an objective from the scoreboard.

Parameters

Returns boolean

Important

This function can't be called in read-only mode.

Warning

This function can throw errors.

setObjectiveAtDisplaySlot

setObjectiveAtDisplaySlot(displaySlotId: DisplaySlotId, objectiveDisplaySetting: ScoreboardObjectiveDisplayOptions): ScoreboardObjective | undefined

Sets an objective into a display slot with specified additional display settings.

Parameters

Returns ScoreboardObjective | undefined - Returns the previous ScoreboardObjective set at the display slot, if no objective was previously set it returns undefined.

Important

This function can't be called in read-only mode.

Warning

This function can throw errors.