Class: ScoreboardObjective
Contains objectives and participants for the scoreboard.
Constructors
new ScoreboardObjective()
private
new ScoreboardObjective():ScoreboardObjective
Returns
Properties
displayName
readonly
displayName:string
Remarks
Returns the player-visible name of this scoreboard objective.
Throws
This property can throw when used.
id
readonly
id:string
Remarks
Identifier of the scoreboard objective.
Throws
This property can throw when used.
Methods
addScore()
addScore(
participant
,scoreToAdd
):number
Parameters
Parameter | Type | Description |
---|---|---|
participant | string | Entity | ScoreboardIdentity | Participant to apply the scoreboard value addition to. |
scoreToAdd | number | - |
Returns
number
Remarks
Adds a score to the given participant and objective.
This function can't be called in read-only mode.
Throws
This function can throw errors.
getParticipants()
getParticipants():
ScoreboardIdentity
[]
Returns
Remarks
Returns all objective participant identities.
Throws
This function can throw errors.
getScore()
getScore(
participant
):number
Parameters
Parameter | Type | Description |
---|---|---|
participant | string | Entity | ScoreboardIdentity | Identifier of the participant to retrieve a score for. |
Returns
number
Remarks
Returns a specific score for a participant.
Throws
This function can throw errors.
getScores()
getScores():
ScoreboardScoreInfo
[]
Returns
Remarks
Returns specific scores for this objective for all participants.
Throws
This function can throw errors.
hasParticipant()
hasParticipant(
participant
):boolean
Parameters
Parameter | Type |
---|---|
participant | string | Entity | ScoreboardIdentity |
Returns
boolean
Remarks
Returns if the specified identity is a participant of the scoreboard objective.
Throws
This function can throw errors.
isValid()
isValid():
boolean
Returns
boolean
Remarks
Returns true if the ScoreboardObjective reference is still valid.
removeParticipant()
removeParticipant(
participant
):boolean
Parameters
Parameter | Type | Description |
---|---|---|
participant | string | Entity | ScoreboardIdentity | Participant to remove from being tracked with this objective. |
Returns
boolean
Remarks
Removes a participant from this scoreboard objective.
This function can't be called in read-only mode.
Throws
This function can throw errors.
setScore()
setScore(
participant
,score
):void
Parameters
Parameter | Type | Description |
---|---|---|
participant | string | Entity | ScoreboardIdentity | Identity of the participant. |
score | number | New value of the score. |
Returns
void
Remarks
Sets a score for a participant.
This function can't be called in read-only mode.
Throws
This function can throw errors.