PlayerTeleportEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct PlayerTeleportEvent : IEventA player is about to be teleported (command, plugin, ender pearl, …). Cancel to stay; the destination may be changed.
| Id | 124 |
| Key | mc:player_teleport |
| Cancellable | yes |
| Fired by the engine | yes |
| Field | Type | Handlers may write | Description |
|---|---|---|---|
Player |
player |
no (readonly) | The player. |
From |
Vec3d |
no (readonly) | Current position. |
To |
Vec3d |
yes | Destination position. |
FromWorld |
world |
no (readonly) | Current dimension. |
ToWorld |
world |
no (readonly) | Destination dimension. |
Cause |
enum:TeleportCause |
no (readonly) | Why. |
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 PlayerTeleportEvent(Player player, Vec3d from, Vec3d to, World fromWorld, World toWorld, TeleportCause cause)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 |
|
fromWorld |
World |
|
toWorld |
World |
|
cause |
TeleportCause |
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Cancelled { get; set; } |
Cancelling stops lower-priority handlers (unless they opt in) and the action itself. |
TeleportCause Cause { get; } |
Why. |
Vec3d From { get; } |
Current position. |
World FromWorld { get; } |
Current dimension. |
Player Player { get; } |
The player. |
Vec3d To { get; set; } |
Destination position. |
World ToWorld { get; } |
Destination dimension. |
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 TeleportCause Cause { get; }Why.
public Vec3d From { get; }Current position.
FromWorld
Section titled “FromWorld”public World FromWorld { get; }Current dimension.
Player
Section titled “Player”public Player Player { get; }The player.
public Vec3d To { get; set; }Destination position.
ToWorld
Section titled “ToWorld”public World ToWorld { get; }Destination dimension.
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.
See also
Section titled “See also”IEvent · Player · TeleportCause · Vec3d · World