Class in @minecraft/server
One objective: a score for each participant.
import { ScoreboardObjective } from '@minecraft/server';Properties
Section titled “Properties”read-only
readonly id: string;displayName
Section titled “displayName”read-only
readonly displayName: string;isValid
Section titled “isValid”read-only
readonly isValid: boolean;False once removed.
Methods
Section titled “Methods”addScore
Section titled “addScore”addScore(participant: ScoreboardParticipant, scoreToAdd: number): number;Parameters
participantScoreboardParticipantscoreToAddnumber
Returns
numberThe score after.Throws
- If the objective has been removed.
getParticipants
Section titled “getParticipants”getParticipants(): ScoreboardIdentity[];Returns
ScoreboardIdentity[]Types
getScore
Section titled “getScore”getScore(participant: ScoreboardParticipant): number | undefined;undefined if they have no score here.
Parameters
participantScoreboardParticipant
Returns
number | undefinedgetScores
Section titled “getScores”getScores(): ScoreboardScoreInfo[];Returns
ScoreboardScoreInfo[]Types
hasParticipant
Section titled “hasParticipant”hasParticipant(participant: ScoreboardParticipant): boolean;Parameters
participantScoreboardParticipant
Returns
booleanremoveParticipant
Section titled “removeParticipant”removeParticipant(participant: ScoreboardParticipant): boolean;Parameters
participantScoreboardParticipant
Returns
booleanFalse if they had no score here.setScore
Section titled “setScore”setScore(participant: ScoreboardParticipant, score: number): void;Parameters
participantScoreboardParticipantscorenumber
Used by
Section titled “Used by”ScoreboardObjectiveDisplayOptions.objective, Scoreboard.addObjective, Scoreboard.removeObjective, Scoreboard.getObjective, Scoreboard.getObjectives, Scoreboard.setObjectiveAtDisplaySlot, Scoreboard.clearObjectiveAtDisplaySlot