Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts
    Before events

    PlayerTeleportBeforeEvent

    Basalt's own: toLocation, the feet, may be moved.

    Interface in @minecraft/server

    Extends CancellableEvent

    Basalt’s own: toLocation, the feet, may be moved.

    import type { PlayerTeleportBeforeEvent } from '@minecraft/server';

    Subscribe to it with world.beforeEvents.playerTeleport.

    import { world, type PlayerTeleportBeforeEvent } from '@minecraft/server';
    world.beforeEvents.playerTeleport.subscribe((event: PlayerTeleportBeforeEvent) => {
    console.log('playerTeleport', event.player.name);
    // Uncomment to stop it from happening.
    // event.cancel = true;
    });
    import { world } from '@minecraft/server';
    world.beforeEvents.playerTeleport.subscribe((event) => {
    console.log('playerTeleport', event.player.name);
    // Uncomment to stop it from happening.
    // event.cancel = true;
    });

    read-only

    readonly player: Player;
    Types

    read-only

    readonly fromLocation: Vector3;
    Types
    toLocation: Vector3;
    Types

    read-only

    readonly cause: "Plugin" | "Command" | "EnderPearl";

    WorldBeforeEvents.playerTeleport

    From CancellableEvent: cancel