Package org.bukkit.scoreboard
Interface Objective
-
public interface ObjectiveAn objective on a scoreboard that can show scores specific to entries. This objective is only relevant to the display of the associatedscoreboard.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description StringgetCriteria()Gets the criteria this objective tracks.StringgetDisplayName()Gets the name displayed to players for this objectiveDisplaySlotgetDisplaySlot()Gets the display slot this objective is displayed at.StringgetName()Gets the name of this ObjectiveRenderTypegetRenderType()Sets manner in which this objective will be rendered.ScoregetScore(String entry)Gets an entry's Score for an Objective on this Scoreboard.ScoregetScore(OfflinePlayer player)Deprecated.Scoreboards can contain entries that aren't playersScoreboardgetScoreboard()Gets the scoreboard to which this objective is attached.booleanisModifiable()Gets if the objective's scores can be modified directly by a plugin.voidsetDisplayName(String displayName)Sets the name displayed to players for this objective.voidsetDisplaySlot(DisplaySlot slot)Sets this objective to display on the specified slot for the scoreboard, removing it from any other display slot.voidsetRenderType(RenderType renderType)Sets manner in which this objective will be rendered.voidunregister()Unregisters this objective from thescoreboard.
-
-
-
Method Detail
-
getName
@NotNull String getName() throws IllegalStateException
Gets the name of this Objective- Returns:
- this objective's name
- Throws:
IllegalStateException- if this objective has been unregistered
-
getDisplayName
@NotNull String getDisplayName() throws IllegalStateException
Gets the name displayed to players for this objective- Returns:
- this objective's display name
- Throws:
IllegalStateException- if this objective has been unregistered
-
setDisplayName
void setDisplayName(@NotNull String displayName) throws IllegalStateException, IllegalArgumentExceptionSets the name displayed to players for this objective.- Parameters:
displayName- Display name to set- Throws:
IllegalStateException- if this objective has been unregisteredIllegalArgumentException- if displayName is nullIllegalArgumentException- if displayName is longer than 128 characters.
-
getCriteria
@NotNull String getCriteria() throws IllegalStateException
Gets the criteria this objective tracks.- Returns:
- this objective's criteria
- Throws:
IllegalStateException- if this objective has been unregistered
-
isModifiable
boolean isModifiable() throws IllegalStateExceptionGets if the objective's scores can be modified directly by a plugin.- Returns:
- true if scores are modifiable
- Throws:
IllegalStateException- if this objective has been unregistered- See Also:
Criterias.HEALTH
-
getScoreboard
@Nullable Scoreboard getScoreboard()
Gets the scoreboard to which this objective is attached.- Returns:
- Owning scoreboard, or null if it has been
unregistered
-
unregister
void unregister() throws IllegalStateExceptionUnregisters this objective from thescoreboard.- Throws:
IllegalStateException- if this objective has been unregistered
-
setDisplaySlot
void setDisplaySlot(@Nullable DisplaySlot slot) throws IllegalStateExceptionSets this objective to display on the specified slot for the scoreboard, removing it from any other display slot.- Parameters:
slot- display slot to change, or null to not display- Throws:
IllegalStateException- if this objective has been unregistered
-
getDisplaySlot
@Nullable DisplaySlot getDisplaySlot() throws IllegalStateException
Gets the display slot this objective is displayed at.- Returns:
- the display slot for this objective, or null if not displayed
- Throws:
IllegalStateException- if this objective has been unregistered
-
setRenderType
void setRenderType(@NotNull RenderType renderType) throws IllegalStateExceptionSets manner in which this objective will be rendered.- Parameters:
renderType- new render type- Throws:
IllegalStateException- if this objective has been unregistered
-
getRenderType
@NotNull RenderType getRenderType() throws IllegalStateException
Sets manner in which this objective will be rendered.- Returns:
- the render type
- Throws:
IllegalStateException- if this objective has been unregistered
-
getScore
@Deprecated @NotNull Score getScore(@NotNull OfflinePlayer player) throws IllegalArgumentException, IllegalStateException
Deprecated.Scoreboards can contain entries that aren't playersGets a player's Score for an Objective on this Scoreboard- Parameters:
player- Player for the Score- Returns:
- Score tracking the Objective and player specified
- Throws:
IllegalArgumentException- if player is nullIllegalStateException- if this objective has been unregistered- See Also:
getScore(String)
-
getScore
@NotNull Score getScore(@NotNull String entry) throws IllegalArgumentException, IllegalStateException
Gets an entry's Score for an Objective on this Scoreboard.- Parameters:
entry- Entry for the Score- Returns:
- Score tracking the Objective and entry specified
- Throws:
IllegalArgumentException- if entry is nullIllegalStateException- if this objective has been unregisteredIllegalArgumentException- if entry is longer than 40 characters.
-
-