Package org.bukkit.scoreboard
Interface Score
public interface Score
-
Method Summary
Modifier and TypeMethodDescriptionGet the custom name for this entry.void
customName
(@Nullable Component customName) Sets the custom name for this entry.getEntry()
Gets the entry being tracked by this ScoreGets the Objective being tracked by this ScoreDeprecated.Scoreboards can contain entries that aren't playersint
getScore()
Gets the current scoreGets the scoreboard for the associated objective.boolean
Shows if this score has been set at any point in time.boolean
Gets if this score is triggerable and cannot be used by the/trigger
command executed by the owner of this score.void
Resets this score, if a value has been set.void
setScore
(int score) Sets the current score.void
setTriggerable
(boolean triggerable) Sets if this score is triggerable and can be used by the/trigger
command executed by the owner of this score.
-
Method Details
-
getPlayer
Deprecated.Scoreboards can contain entries that aren't playersGets the OfflinePlayer being tracked by this Score- Returns:
- this Score's tracked player
- See Also:
-
getEntry
Gets the entry being tracked by this Score- Returns:
- this Score's tracked entry
-
getObjective
Gets the Objective being tracked by this Score- Returns:
- this Score's tracked objective
-
getScore
int getScore()Gets the current score- Returns:
- the current score
- Throws:
IllegalStateException
- if the associated objective has been unregistered
-
setScore
void setScore(int score) Sets the current score.- Parameters:
score
- New score- Throws:
IllegalStateException
- if the associated objective has been unregistered
-
isScoreSet
boolean isScoreSet()Shows if this score has been set at any point in time.- Returns:
- if this score has been set before
- Throws:
IllegalStateException
- if the associated objective has been unregistered
-
getScoreboard
Gets the scoreboard for the associated objective.- Returns:
- the owning objective's scoreboard, or null if it has been
unregistered
-
resetScore
Resets this score, if a value has been set.- Throws:
IllegalStateException
- if the associated objective has been unregistered
-
isTriggerable
boolean isTriggerable()Gets if this score is triggerable and cannot be used by the/trigger
command executed by the owner of this score.- Returns:
- true if triggerable, false if not triggerable, score isn't set, or the objective isn't
Criteria.TRIGGER
- Throws:
IllegalStateException
- if the associated objective has been unregistered
-
setTriggerable
void setTriggerable(boolean triggerable) Sets if this score is triggerable and can be used by the/trigger
command executed by the owner of this score. Can only be set onCriteria.TRIGGER
objectives.If the score doesn't exist (aka
isScoreSet()
returns false), this will create the score with a 0 value.- Parameters:
triggerable
- true to enable trigger, false to disable- Throws:
IllegalArgumentException
- if this objective isn'tCriteria.TRIGGER
IllegalStateException
- if the associated objective has been unregistered
-
customName
Get the custom name for this entry.- Returns:
- the custom name or null if not set (or score isn't set)
- Throws:
IllegalStateException
- if the associated objective has been unregistered
-
customName
Sets the custom name for this entry.If the score doesn't exist (aka
isScoreSet()
returns false), this will create the score with a 0 value.- Parameters:
customName
- the custom name or null to reset- Throws:
IllegalStateException
- if the associated objective has been unregistered
-