Skip to content

PlayerPortalEvent

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

public ref struct PlayerPortalEvent : IEvent

A player is about to travel through a portal (nether portal, end portal, end gateway). Cancel to stay.

Id 125
Key mc:player_portal
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.
FromWorld world no (readonly) Current dimension.
ToWorld world no (readonly) Destination dimension.
Cause enum:TeleportCause no (readonly) Which portal.

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 PlayerPortalEvent(Player player, Vec3d from, 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
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; } Which portal.
Vec3d From { get; } Current position.
World FromWorld { get; } Current dimension.
Player Player { get; } The player.
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; }

Which portal.

public Vec3d From { get; }

Current position.

public World FromWorld { get; }

Current dimension.

public Player Player { get; }

The player.

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