PlayerMoveEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct PlayerMoveEvent : IEventA player moved or rotated. Cancel to teleport the player back; ‘to’, ‘yaw’ and ‘pitch’ may be rewritten. Fires for every accepted movement packet: keep handlers cheap.
| Id | 13 |
| Key | mc:player_move |
| Cancellable | yes |
| Fired by the engine | yes |
| Field | Type | Handlers may write | Description |
|---|---|---|---|
Player |
player |
no (readonly) | The player. |
From |
Vec3d |
no (readonly) | Position before the move. |
To |
Vec3d |
yes | Position after the move. |
Yaw |
float |
yes | Yaw after the move. |
Pitch |
float |
yes | Pitch after the move. |
OnGround |
bool |
no (readonly) | Whether the client reports being on the ground. |
Set e.Cancelled = true in a handler to cancel it; lower-priority handlers are skipped unless they subscribed with receiveCancelled: true.
Constructors
Section titled “Constructors”| Member | Description |
|---|---|
Constructor |
Creates the event (for firing it from a plugin; native code builds its own). |
Constructor
Section titled “Constructor”public PlayerMoveEvent(Player player, Vec3d from, Vec3d to, float yaw, float pitch, bool onGround)Creates the event (for firing it from a plugin; native code builds its own). Signature of API 1.0.
Parameters
| Name | Type | Description |
|---|---|---|
player |
Player |
|
from |
Vec3d |
|
to |
Vec3d |
|
yaw |
float |
|
pitch |
float |
|
onGround |
bool |
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Cancelled { get; set; } |
Cancelling stops lower-priority handlers (unless they opt in) and the action itself. |
Vec3d From { get; } |
Position before the move. |
bool OnGround { get; } |
Whether the client reports being on the ground. |
float Pitch { get; set; } |
Pitch after the move. |
Player Player { get; } |
The player. |
Vec3d To { get; set; } |
Position after the move. |
float Yaw { get; set; } |
Yaw after the move. |
static ushort CatalogueId { get; } |
Catalogue id (stable ABI). |
static bool IsCancellable { get; } |
Whether handlers can cancel the event. |
static string Key { get; } |
Registry key of the event. |
Cancelled
Section titled “Cancelled”public bool Cancelled { get; set; }Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
public Vec3d From { get; }Position before the move.
OnGround
Section titled “OnGround”public bool OnGround { get; }Whether the client reports being on the ground.
public float Pitch { get; set; }Pitch after the move.
Player
Section titled “Player”public Player Player { get; }The player.
public Vec3d To { get; set; }Position after the move.
public float Yaw { get; set; }Yaw after the move.
CatalogueId
Section titled “CatalogueId”public static ushort CatalogueId { get; }Catalogue id (stable ABI).
IsCancellable
Section titled “IsCancellable”public static bool IsCancellable { get; }Whether handlers can cancel the event.
public static string Key { get; }Registry key of the event.