83 lines
1.8 KiB
Markdown
83 lines
1.8 KiB
Markdown
---
|
||
sidebarDepth: 1
|
||
---
|
||
# 权限
|
||
|
||
## GetPlayerAbilities
|
||
|
||
<span style="display:inline;color:#ff5555">服务端</span>
|
||
|
||
method in mod.server.component.playerCompServer.PlayerCompServer
|
||
|
||
- 描述
|
||
|
||
获取玩家具体权限
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| dict | 具体权限,详见备注 |
|
||
|
||
- 备注
|
||
- 具体权限说明
|
||
| 权限字段 | 数据类型 | 说明 |
|
||
| --------| ---- |------|
|
||
| build | bool | 放置方块 |
|
||
| mine | bool | 采集方块 |
|
||
| doorsandswitches | bool | 使用门和开关 |
|
||
| opencontainers | bool | 打开容器 |
|
||
| attackplayers | bool | 攻击玩家 |
|
||
| attackmobs | bool | 攻击生物 |
|
||
| op | bool | 操作员命令 |
|
||
| teleport | bool | 使用传送 |
|
||
- 返回值示例
|
||
```python
|
||
{'teleport': True, 'opencontainers': True, 'mine': True, 'build': True, 'op': True, 'attackmobs': True, 'doorsandswitches': True, 'attackplayers': True}
|
||
```
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.server.extraServerApi as serverApi
|
||
comp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)
|
||
operation = comp.GetPlayerAbilities()
|
||
```
|
||
|
||
|
||
|
||
## GetPlayerOperation
|
||
|
||
<span style="display:inline;color:#ff5555">服务端</span>
|
||
|
||
method in mod.server.component.playerCompServer.PlayerCompServer
|
||
|
||
- 描述
|
||
|
||
获取玩家权限类型信息
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| int | 权限类型,Visitor为0,Member为1,Operator为2,Custom为3 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.server.extraServerApi as serverApi
|
||
comp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)
|
||
operation = comp.GetPlayerOperation()
|
||
```
|
||
|
||
|
||
|