Skip to main content

Class: Scoreboard

Contains objectives and participants for the scoreboard.

Constructors

new Scoreboard()

private new Scoreboard(): Scoreboard

Returns

Scoreboard

Methods

addObjective()

addObjective(objectiveId, displayName?): ScoreboardObjective

Parameters

ParameterType
objectiveIdstring
displayName?string

Returns

ScoreboardObjective

Remarks

Adds a new objective to the scoreboard.

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

Throws

This function can throw errors.


clearObjectiveAtDisplaySlot()

clearObjectiveAtDisplaySlot(displaySlotId): ScoreboardObjective

Parameters

ParameterType
displaySlotIdDisplaySlotId

Returns

ScoreboardObjective

Remarks

Clears the objective that occupies a display slot.

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


getObjective()

getObjective(objectiveId): ScoreboardObjective

Parameters

ParameterTypeDescription
objectiveIdstringIdentifier of the objective.

Returns

ScoreboardObjective

Remarks

Returns a specific objective (by id).


getObjectiveAtDisplaySlot()

getObjectiveAtDisplaySlot(displaySlotId): ScoreboardObjectiveDisplayOptions

Parameters

ParameterType
displaySlotIdDisplaySlotId

Returns

ScoreboardObjectiveDisplayOptions

Remarks

Returns an objective that occupies the specified display slot.


getObjectives()

getObjectives(): ScoreboardObjective[]

Returns

ScoreboardObjective[]

Remarks

Returns all defined objectives.


getParticipants()

getParticipants(): ScoreboardIdentity[]

Returns

ScoreboardIdentity[]

Remarks

Returns all defined scoreboard identities.


removeObjective()

removeObjective(objectiveId): boolean

Parameters

ParameterType
objectiveIdstring | ScoreboardObjective

Returns

boolean

Remarks

Removes an objective from the scoreboard.

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

Throws

This function can throw errors.


setObjectiveAtDisplaySlot()

setObjectiveAtDisplaySlot(displaySlotId, objectiveDisplaySetting): ScoreboardObjective

Parameters

ParameterType
displaySlotIdDisplaySlotId
objectiveDisplaySettingScoreboardObjectiveDisplayOptions

Returns

ScoreboardObjective

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

Remarks

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

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

Throws

This function can throw errors.