外观
players API
模块说明
text
Opt-in cached player reads; a Host session is not a world/event revision.list_players
python
async def list_players(peer, session: str) -> list[PlayerIdentity]SDK 说明:
text
Return validated player records. XUID may be empty; never auto-retry.PlayerNotFound
python
class PlayerNotFound(LookupError)SDK 说明:
text
No cached roster entry satisfies all requested identity fields.另继承外部类型 LookupError;其通用方法不在本 SDK 目录中重复展开。
AmbiguousPlayer
python
class AmbiguousPlayer(LookupError)SDK 说明:
text
Several entries match; choosing one would invent identity.另继承外部类型 LookupError;其通用方法不在本 SDK 目录中重复展开。
find_player
python
def find_player(
players: list[PlayerIdentity],
*,
name: str | None = None,
uuid: str | None = None,
xuid: str | None = None,
) -> PlayerIdentitySDK 说明:
text
Exact, case-sensitive match of all supplied fields; return a copy.
No fuzzy names, empty-XUID fallback, or durable online guarantee. Supply UUID
or XUID when available. An old snapshot cannot prove a player remains online.resolve_player
python
async def resolve_player(
peer,
session: str,
*,
name: str | None = None,
uuid: str | None = None,
xuid: str | None = None,
) -> PlayerIdentitySDK 说明:
text
Read the cached Host roster once with permissions.players = ["list"], then resolve exactly.player_target
python
def player_target(name: str) -> strSDK 说明:
text
Build a Bedrock exact-name selector; this does not authorize a player.
Names should come from resolve_player/current observations. Selectors and
command fragments cannot be passed through this helper. A leading ! is
rejected because Bedrock name selectors support negation.