Package cn.nukkit.scoreboard.scoreboard
Class Scoreboard
java.lang.Object
cn.nukkit.scoreboard.scoreboard.Scoreboard
- All Implemented Interfaces:
IScoreboard
@PowerNukkitXOnly
@Since("1.19.30-r1")
public class Scoreboard
extends Object
implements IScoreboard
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected String
protected Map<IScorer,
IScoreboardLine> protected String
protected SortOrder
protected Map<DisplaySlot,
Set<IScoreboardViewer>> -
Constructor Summary
ConstructorDescriptionScoreboard
(String objectiveName, String displayName) Scoreboard
(String objectiveName, String displayName, String criteriaName) Scoreboard
(String objectiveName, String displayName, String criteriaName, SortOrder sortOrder) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addLine
(IScoreboardLine line) 为此计分板添加一个行boolean
为此计分板添加一个行boolean
为插件提供的便捷的计分板显示接口boolean
addViewer
(IScoreboardViewer viewer, DisplaySlot slot) 向此计分板目标槽位中添加一个观察者boolean
containLine
(IScorer scorer) 检查追踪对象在此计分板上是否有记录boolean
containViewer
(IScoreboardViewer viewer, DisplaySlot slot) 检查此计分板目标槽位中是否有特定观察者获取追踪对象在此计分板上对应的行(如果存在)getLines()
getViewers
(DisplaySlot slot) boolean
removeAllLine
(boolean send) 删除计分板所有行boolean
removeLine
(IScorer scorer) 删除追踪对象在此计分板上对应的行(如果存在)boolean
removeViewer
(IScoreboardViewer viewer, DisplaySlot slot) 删除此计分板目标槽位中的某个观察者void
resend()
向所有观察者重新发送此计分板以及行信息
例如当对计分板进行了大量的更改后,调用此方法
可节省大量带宽void
setLines
(Collection<IScoreboardLine> lines) 按照List顺序设置计分板的内容
会覆盖之前的所有行void
为插件提供的快捷接口
按照List顺序设置计分板的内容 (使用FakeScorer作为追踪对象)
会覆盖之前的所有行void
setSortOrder
(SortOrder sortOrder) 设置计分板的排序规则void
updateScore
(IScoreboardLine update) 向所有观察者发送新的分数
-
Field Details
-
objectiveName
-
displayName
-
criteriaName
-
sortOrder
-
viewers
-
lines
-
-
Constructor Details
-
Scoreboard
-
Scoreboard
-
Scoreboard
-
-
Method Details
-
getAllViewers
- Specified by:
getAllViewers
in interfaceIScoreboard
- Returns:
- 此计分板的所有观察者
-
getViewers
- Specified by:
getViewers
in interfaceIScoreboard
- Parameters:
slot
- 目标槽位- Returns:
- 此计分板目标槽位的观察者
-
removeViewer
Description copied from interface:IScoreboard
删除此计分板目标槽位中的某个观察者- Specified by:
removeViewer
in interfaceIScoreboard
- Parameters:
viewer
- 目标观察者slot
- 目标槽位- Returns:
- 是否删除成功
-
addViewer
Description copied from interface:IScoreboard
向此计分板目标槽位中添加一个观察者- Specified by:
addViewer
in interfaceIScoreboard
- Parameters:
viewer
- 目标观察者slot
- 目标槽位- Returns:
- 是否添加成功
-
containViewer
Description copied from interface:IScoreboard
检查此计分板目标槽位中是否有特定观察者- Specified by:
containViewer
in interfaceIScoreboard
- Parameters:
viewer
- 目标观察者slot
- 目标槽位- Returns:
- 是否存在
-
getLine
Description copied from interface:IScoreboard
获取追踪对象在此计分板上对应的行(如果存在)- Specified by:
getLine
in interfaceIScoreboard
- Parameters:
scorer
- 追踪对象- Returns:
- 对应行
-
addLine
Description copied from interface:IScoreboard
为此计分板添加一个行- Specified by:
addLine
in interfaceIScoreboard
- Parameters:
line
- 目标行- Returns:
- 是否添加成功
-
addLine
Description copied from interface:IScoreboard
为此计分板添加一个行- Specified by:
addLine
in interfaceIScoreboard
- Parameters:
scorer
- 追踪对象score
- 分数- Returns:
- 是否添加成功
-
addLine
Description copied from interface:IScoreboard
为插件提供的便捷的计分板显示接口- Specified by:
addLine
in interfaceIScoreboard
- Parameters:
text
- FakeScorer的名称score
- 分数- Returns:
- 是否添加成功
-
removeLine
Description copied from interface:IScoreboard
删除追踪对象在此计分板上对应的行(如果存在)- Specified by:
removeLine
in interfaceIScoreboard
- Parameters:
scorer
- 目标追踪对象- Returns:
- 是否删除成功
-
removeAllLine
public boolean removeAllLine(boolean send) Description copied from interface:IScoreboard
删除计分板所有行- Specified by:
removeAllLine
in interfaceIScoreboard
- Parameters:
send
- 是否发送到观察者- Returns:
- 是否删除成功
-
containLine
Description copied from interface:IScoreboard
检查追踪对象在此计分板上是否有记录- Specified by:
containLine
in interfaceIScoreboard
- Parameters:
scorer
- 目标追踪对象- Returns:
- 是否存在
-
updateScore
Description copied from interface:IScoreboard
向所有观察者发送新的分数- Specified by:
updateScore
in interfaceIScoreboard
- Parameters:
update
- 需要更新的行
-
resend
public void resend()Description copied from interface:IScoreboard
向所有观察者重新发送此计分板以及行信息
例如当对计分板进行了大量的更改后,调用此方法
可节省大量带宽- Specified by:
resend
in interfaceIScoreboard
-
setLines
Description copied from interface:IScoreboard
为插件提供的快捷接口
按照List顺序设置计分板的内容 (使用FakeScorer作为追踪对象)
会覆盖之前的所有行- Specified by:
setLines
in interfaceIScoreboard
- Parameters:
lines
- 需要设置的字符串内容
-
setLines
Description copied from interface:IScoreboard
按照List顺序设置计分板的内容
会覆盖之前的所有行- Specified by:
setLines
in interfaceIScoreboard
- Parameters:
lines
- 需要设置的行内容
-
getObjectiveName
- Specified by:
getObjectiveName
in interfaceIScoreboard
- Returns:
- 此计分板的标识名称
-
getDisplayName
- Specified by:
getDisplayName
in interfaceIScoreboard
- Returns:
- 此计分板的显示名称
-
getCriteriaName
- Specified by:
getCriteriaName
in interfaceIScoreboard
- Returns:
- 此计分板的 “准则” (eg: dummy)
-
getSortOrder
- Specified by:
getSortOrder
in interfaceIScoreboard
- Returns:
- 此计分板的排序规则
-
getViewers
-
getLines
- Specified by:
getLines
in interfaceIScoreboard
- Returns:
- 此计分板的所有行
-
setSortOrder
Description copied from interface:IScoreboard
设置计分板的排序规则- Specified by:
setSortOrder
in interfaceIScoreboard
- Parameters:
sortOrder
- 排序规则
-