跳转到正文

player_actions API ​

完整接口目录 · 玩家查询用法 · 工具包下载

模块说明 ​

text
Exact-name Bedrock convenience intents over the native command gate.

PlayerActions ​

python
class PlayerActions

SDK 说明:

text
Prepare only; submit and inspect the original receipt with Operations.

Requires the broad framework.command.execute permission. Exact player names
are execution-time selectors, not durable UUID bindings or online checks.
Each call needs a caller-owned key and fixed deadline. No automatic retry,
command-feedback changes, permission grants, or synthetic success results.

PlayerActions.__init__ ​

python
def __init__(self, operations: Operations)

PlayerActions.teleport ​

python
def teleport(
    self,
    name: str,
    position,
    *,
    idempotency_key: str,
    deadline: str,
    rotation = None,
    check_for_blocks: bool = False,
) -> OperationIntent

SDK 说明:

text
Absolute coordinates in the command executor's dimension; yaw, pitch optional.

PlayerActions.teleport_to ​

python
def teleport_to(
    self,
    name: str,
    destination_name: str,
    *,
    idempotency_key: str,
    deadline: str,
    check_for_blocks: bool = False,
) -> OperationIntent

SDK 说明:

text
Teleport to another exact-name player, resolved by the server at execution.

PlayerActions.give ​

python
def give(
    self,
    name: str,
    item: str,
    *,
    idempotency_key: str,
    deadline: str,
    count: int = 1,
    data: int = 0,
) -> OperationIntent

SDK 说明:

text
Give a basic item. Custom NBT belongs to the existing World item helpers.

PlayerActions.clear ​

python
def clear(
    self,
    name: str,
    item: str | None = None,
    *,
    idempotency_key: str,
    deadline: str,
    data: int = -1,
    max_count: int = -1,
) -> OperationIntent

SDK 说明:

text
Omit item to clear the entire inventory; max_count=0 only tests matches.

PlayerActions.effect ​

python
def effect(
    self,
    name: str,
    effect: str,
    *,
    idempotency_key: str,
    deadline: str,
    seconds: int = 30,
    amplifier: int = 0,
    hide_particles: bool = False,
) -> OperationIntent

SDK 说明:

text
Timed effect; seconds=0 removes that effect using the older Bedrock form.

PlayerActions.clear_effect ​

python
def clear_effect(
    self,
    name: str,
    effect: str | None = None,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Clear all effects, or one effect via a zero-second application.

PlayerActions.gamemode ​

python
def gamemode(
    self,
    name: str,
    mode: str,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

PlayerActions.tag_add ​

python
def tag_add(
    self,
    name: str,
    tag: str,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

PlayerActions.tag_remove ​

python
def tag_remove(
    self,
    name: str,
    tag: str,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

PlayerActions.tag_list ​

python
def tag_list(self, name: str, *, idempotency_key: str, deadline: str) -> OperationIntent

SDK 说明:

text
Keep native output messages; no locale-dependent tag-list parsing.

PlayerActions.tag_test ​

python
def tag_test(
    self,
    name: str,
    tag: str,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Test exact-name + tag via testfor. No match can also mean player offline.

PlayerActions.playsound ​

python
def playsound(
    self,
    name: str,
    sound: str,
    *,
    idempotency_key: str,
    deadline: str,
    position = None,
    volume: float = 1,
    pitch: float = 1,
    minimum_volume: float = 0,
) -> OperationIntent

SDK 说明:

text
Play at the target's current position/dimension unless an absolute position is supplied.

PlayerActions.stopsound ​

python
def stopsound(
    self,
    name: str,
    sound: str | None = None,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Omit sound to stop every sound for the target.

PlayerActions.kick ​

python
def kick(
    self,
    name: str,
    reason: str,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

PlayerActions.xp ​

python
def xp(
    self,
    name: str,
    points: int,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Add nonnegative experience points (not levels).

PlayerActions.spawnpoint ​

python
def spawnpoint(
    self,
    name: str,
    position,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Set an absolute respawn position in the command executor's dimension.

PlayerActions.operations ​

python
self.operations

公开实例属性,在 __init__ 中设置。

PlayerActions.commands ​

python
self.commands

公开实例属性,在 __init__ 中设置。

Neomega · 使用、开发与参考文档