@NonnullByDefault public class PacketScoreboardObjective extends Object implements ScoreboardObjective
ScoreboardObjective using ProtocolLib.| Constructor and Description |
|---|
PacketScoreboardObjective(String id,
String displayName,
DisplaySlot displaySlot)
Creates a new scoreboard objective
|
PacketScoreboardObjective(String id,
String displayName,
DisplaySlot displaySlot,
boolean autoSubscribe)
Creates a new scoreboard objective
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyLines(Collection<String> lines)
Automatically applies a set of score lines to this objective.
|
void |
applyLines(String... lines)
Automatically applies a set of score lines to this objective.
|
void |
applyScores(Map<String,Integer> scores)
Applies a score mapping to this objective
|
void |
clearScores()
Clears the scores from this objective
|
String |
getDisplayName()
Gets the current display name of this objective
|
DisplaySlot |
getDisplaySlot()
Gets the current display slot of this objective
|
String |
getId()
Gets the id of this objective
|
Integer |
getScore(String name)
Gets the value mapped to a given score, if present
|
Map<String,Integer> |
getScores()
Gets an immutable copy of the current objective scores
|
boolean |
hasScore(String name)
Returns true if this objective has a given score
|
boolean |
removeScore(String name)
Removes a score
|
void |
setAutoSubscribe(boolean autoSubscribe)
Sets if players should be automatically subscribed to this objective.
|
void |
setDisplayName(String displayName)
Lazily sets the display name to a new value and updates the objectives subscribers
|
void |
setDisplaySlot(DisplaySlot displaySlot)
Lazily sets the display slot to a new value and updates the objectives subscribers
|
void |
setScore(String name,
int value)
Sets a new score value
|
boolean |
shouldAutoSubscribe()
Gets if players should be automatically subscribed to this objective.
|
void |
subscribe(Player player)
Subscribes a player to this objective
|
void |
unsubscribe(Player player)
Unsubscribes a player from this objective
|
void |
unsubscribe(Player player,
boolean fast)
Unsubscribes a player from this objective
|
void |
unsubscribeAll()
Unsubscribes all players from this objective
|
public PacketScoreboardObjective(String id, String displayName, DisplaySlot displaySlot, boolean autoSubscribe)
id - the id of this objectivedisplayName - the initial display namedisplaySlot - the initial display slotautoSubscribe - if players should be automatically subscribedpublic PacketScoreboardObjective(String id, String displayName, DisplaySlot displaySlot)
id - the id of this objectivedisplayName - the initial display namedisplaySlot - the initial display slotpublic String getId()
ScoreboardObjectivegetId in interface ScoreboardObjectivepublic boolean shouldAutoSubscribe()
ScoreboardObjectiveshouldAutoSubscribe in interface ScoreboardObjectivepublic void setAutoSubscribe(boolean autoSubscribe)
ScoreboardObjectivesetAutoSubscribe in interface ScoreboardObjectiveautoSubscribe - if players should be automatically subscribedpublic String getDisplayName()
ScoreboardObjectivegetDisplayName in interface ScoreboardObjectivepublic void setDisplayName(String displayName)
ScoreboardObjectivesetDisplayName in interface ScoreboardObjectivedisplayName - the new display namepublic DisplaySlot getDisplaySlot()
ScoreboardObjectivegetDisplaySlot in interface ScoreboardObjectivepublic void setDisplaySlot(DisplaySlot displaySlot)
ScoreboardObjectivesetDisplaySlot in interface ScoreboardObjectivedisplaySlot - the new display slotpublic Map<String,Integer> getScores()
ScoreboardObjectivegetScores in interface ScoreboardObjectivepublic boolean hasScore(String name)
ScoreboardObjectivehasScore in interface ScoreboardObjectivename - the name of the score to check for@Nullable public Integer getScore(String name)
ScoreboardObjectivegetScore in interface ScoreboardObjectivename - the name of the scorepublic void setScore(String name, int value)
ScoreboardObjectivesetScore in interface ScoreboardObjectivename - the name of the scorevalue - the value to set the score topublic boolean removeScore(String name)
ScoreboardObjectiveremoveScore in interface ScoreboardObjectivename - the name of the scorepublic void clearScores()
ScoreboardObjectiveclearScores in interface ScoreboardObjectivepublic void applyScores(Map<String,Integer> scores)
ScoreboardObjectiveapplyScores in interface ScoreboardObjectivescores - the scores to applypublic void applyLines(String... lines)
ScoreboardObjectiveapplyLines in interface ScoreboardObjectivelines - the lines to applypublic void applyLines(Collection<String> lines)
ScoreboardObjectiveapplyLines in interface ScoreboardObjectivelines - the lines to applypublic void subscribe(Player player)
ScoreboardObjectivesubscribe in interface ScoreboardObjectiveplayer - the player to subscribepublic void unsubscribe(Player player)
ScoreboardObjectiveunsubscribe in interface ScoreboardObjectiveplayer - the player to unsubscribepublic void unsubscribe(Player player, boolean fast)
ScoreboardObjectiveunsubscribe in interface ScoreboardObjectiveplayer - the player to unsubscribefast - if true, the removal packet will not be sent (for use when the player is leaving)public void unsubscribeAll()
ScoreboardObjectiveunsubscribeAll in interface ScoreboardObjectiveCopyright © 2020. All rights reserved.