在线玩家信息
获取在线玩家名列表
python
allplayers: list[str]
1
- 获取当前在线玩家名列表
- 示例
- 类式插件中:
pythonclass MyPlugin(Plugin): def on_inject(self): print(self.game_ctrl.allplayers)
1
2
3
4- 注入式插件中:
python:::from tooldelta.game_utils import get_all_player allplayers = get_all_player()
1
2
3
获取机器人名称
python
bot_name: str
1
- 获取 ToolDelta 机器人的名称
- 示例
- 类式插件中:
pythonclass MyPlugin(Plugin): def on_inject(self): print(self.game_ctrl.bot_name)
1
2
3
4
获取在线玩家 UUID
python
players_uuid: dict[str, str]
1
- 获取当前在线玩家名与uuid的对应关系
- 示例
- 类式插件中:
pythonclass MyPlugin(Plugin): def on_inject(self): print(self.game_ctrl.players_uuid)
1
2
3
4
判断玩家是否为管理员
python
def is_op(name: str) -> bool
1
- 判断一个玩家是否为 OP (操作员)。
- 参数:
- name (str):玩家名
- 返回:
- bool:是否为 OP
- 示例
python
from tooldelta.game_utils import is_op
print(is_op("SuperScript"))
1
2
3
2
3
如果你想获取单个玩家的更多信息(例如权限状态等),且你的插件使用的游戏框架是 NeOmega 框架,那么可以前往这里了解更多 API。