Files
netease-modsdk-wiki/docs/mcdocs/1-ModAPI/接口/世界/记分板.md
2025-03-18 14:46:12 +08:00

136 lines
3.2 KiB
Markdown

---
sidebarDepth: 1
---
# 记分板
## GetAllPlayerScoreboardObjects
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
### 服务端接口
<span id="s0"></span>
method in mod.server.component.gameCompServer.GameComponentServer
- 描述
获取玩家记分项
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| list(dict) | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#玩家记分项信息字典列表#玩家记分项信息字典列表">玩家记分项信息字典</a>列表 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateGame(levelId)
print(comp.GetAllPlayerScoreboardObjects())
```
### 客户端接口
<span id="c0"></span>
method in mod.client.component.gameCompClient.GameComponentClient
- 描述
获取玩家记分项
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| list(dict) | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#玩家记分项信息字典列表#玩家记分项信息字典列表">玩家记分项信息字典</a>列表 |
- 备注
- 注意,只有使用命令 /scoreboard objectives setdisplay sidebar xxx 设置显示后的记分项才能在客户端侧获取到
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
print(comp.GetAllPlayerScoreboardObjects())
```
## GetAllScoreboardObjects
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
### 服务端接口
<span id="s0"></span>
method in mod.server.component.gameCompServer.GameComponentServer
- 描述
获取所有记分板项
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| list(dict) | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#记分板记分准则信息字典#记分板记分准则信息字典">记分准则信息字典</a>列表 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateGame(levelId)
print(comp.GetAllScoreboardObjects())
```
### 客户端接口
<span id="c0"></span>
method in mod.client.component.gameCompClient.GameComponentClient
- 描述
获取所有记分板项
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| list(dict) | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#记分板记分准则信息字典#记分板记分准则信息字典">记分准则信息字典</a>列表 |
- 备注
- 注意,只有使用命令 /scoreboard objectives setdisplay sidebar xxx 设置显示后的记分项才能在客户端侧获取到
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
print(comp.GetAllScoreboardObjects())
```