Files
netease-modsdk-wiki/docs/mcdocs/1-ModAPI/接口/玩家/权限.md
2025-03-17 13:24:39 +08:00

83 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
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为0Member为1Operator为2Custom为3 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)
operation = comp.GetPlayerOperation()
```