外观
player_actions API
模块说明
text
Exact-name Bedrock convenience intents over the native command gate.PlayerActions
python
class PlayerActionsSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentPlayerActions.tag_add
python
def tag_add(
self,
name: str,
tag: str,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentPlayerActions.tag_remove
python
def tag_remove(
self,
name: str,
tag: str,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentPlayerActions.tag_list
python
def tag_list(self, name: str, *, idempotency_key: str, deadline: str) -> OperationIntentSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentSDK 说明:
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,
) -> OperationIntentPlayerActions.xp
python
def xp(
self,
name: str,
points: int,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentSDK 说明:
text
Add nonnegative experience points (not levels).PlayerActions.spawnpoint
python
def spawnpoint(
self,
name: str,
position,
*,
idempotency_key: str,
deadline: str,
) -> OperationIntentSDK 说明:
text
Set an absolute respawn position in the command executor's dimension.PlayerActions.operations
python
self.operations公开实例属性,在 __init__ 中设置。
PlayerActions.commands
python
self.commands公开实例属性,在 __init__ 中设置。