Scoreboard Class
Contains objectives and participants for the scoreboard.
Methods
- addObjective
- clearObjectiveAtDisplaySlot
- getObjective
- getObjectiveAtDisplaySlot
- getObjectives
- getParticipants
- removeObjective
- setObjectiveAtDisplaySlot
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
- displaySlotId: DisplaySlotId
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
- displaySlotId: DisplaySlotId
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
- objectiveId: ScoreboardObjective | string
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
- displaySlotId: DisplaySlotId
- objectiveDisplaySetting: ScoreboardObjectiveDisplayOptions
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for