外观
player_handle API
模块说明
text
Immutable cached player identity with explicit, prepare-only conveniences.PlayerIdentityChanged
python
class PlayerIdentityChanged(LookupError)SDK 说明:
text
The original name no longer has exactly the resolved identity.另继承外部类型 LookupError;其通用方法不在本 SDK 目录中重复展开。
PlayerHandle
python
@dataclass(frozen=True)
class PlayerHandleSDK 说明:
text
A cached identity, not an online guarantee or atomic UUID command binding.
Obtain with resolve or ctx.player. Preparing an action does not refresh the
cache or perform IO. Server commands resolve names when they execute, so a
refresh cannot eliminate the check/use race. Retain intents and receipts.字段(包含继承字段):
PlayerHandle.name
python
name: str数据类字段;声明于 player_handle.PlayerHandle。
PlayerHandle.uuid
python
uuid: str数据类字段;声明于 player_handle.PlayerHandle。
PlayerHandle.xuid
python
xuid: str数据类字段;声明于 player_handle.PlayerHandle。
PlayerHandle.session
python
session: str数据类字段;声明于 player_handle.PlayerHandle。
该类型另有以下内部字段,参与数据类声明但不建议直接读写;创建对象时优先使用专题中的工厂方法:
python
_peer: object = field(repr=False, compare=False)
_operations: Operations = field(repr=False, compare=False)PlayerHandle.identity
python
@property
def identity(self)SDK 说明:
text
Read-only identity; empty UUID/XUID fields remain unknown.PlayerHandle.resolve
python
@classmethod
async def resolve(
cls,
peer,
operations: Operations,
*,
name: str | None = None,
uuid: str | None = None,
xuid: str | None = None,
)SDK 说明:
text
Read the Host roster once; match every supplied field exactly.PlayerHandle.refresh
python
async def refresh(self)SDK 说明:
text
Check original name and all fields once; never rebind or retry.
Missing/ambiguous names keep PlayerNotFound/AmbiguousPlayer. Any changed
field (including unknown becoming known) requires explicit new resolve.PlayerHandle.notify
python
def notify(
self,
text: str,
*,
idempotency_key: str,
deadline: str,
max_command_bytes: int = 320,
) -> NotificationPlanSDK 说明:
text
Prepare the existing bounded, journalled notification plan.PlayerHandle.title
python
def title(self, text: str, *, idempotency_key: str, deadline: str) -> OperationIntentPlayerHandle.subtitle
python
def subtitle(self, text: str, *, idempotency_key: str, deadline: str) -> OperationIntentPlayerHandle.actionbar
python
def actionbar(
self,
text: str,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentPlayerHandle.position
python
def position(self, *, idempotency_key: str, deadline: str) -> OperationIntentSDK 说明:
text
Prepare a native single-name entity sample; no coordinate correction.PlayerHandle.score
python
def score(
self,
objective: str,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentPlayerHandle.set_score
python
def set_score(
self,
objective: str,
value: int,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentPlayerHandle.add_score
python
def add_score(
self,
objective: str,
delta: int,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentPlayerHandle.reset_score
python
def reset_score(
self,
objective: str,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentPlayerHandle.give
python
def give(
self,
item: str,
*,
idempotency_key: str,
deadline: str,
count: int = 1,
data: int = 0,
) -> OperationIntent