Skip to content

PlayerTeleportEvent

Namespace Mc.Scripting.Events · Kind struct (ref)

public ref struct PlayerTeleportEvent : IEvent

A 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.

Member Description
Constructor Creates the event (for firing it from a plugin; native code builds its own).
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
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.
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.

public World FromWorld { get; }

Current dimension.

public Player Player { get; }

The player.

public Vec3d To { get; set; }

Destination position.

public World ToWorld { get; }

Destination dimension.

public static ushort CatalogueId { get; }

Catalogue id (stable ABI).

public static bool IsCancellable { get; }

Whether handlers can cancel the event.

public static string Key { get; }

Registry key of the event.

IEvent · Player · TeleportCause · Vec3d · World