The PlayerSpawnAfterEvent interface in @minecraft/server.
Interface in @minecraft/server
import type { PlayerSpawnAfterEvent } from '@minecraft/server';Subscribe to it with world.afterEvents.playerSpawn.
Example
Section titled “Example”import { world, type PlayerSpawnAfterEvent } from '@minecraft/server';
world.afterEvents.playerSpawn.subscribe((event: PlayerSpawnAfterEvent) => { console.log('playerSpawn', event.player.name, event.initialSpawn);});import { world } from '@minecraft/server';
world.afterEvents.playerSpawn.subscribe((event) => { console.log('playerSpawn', event.player.name, event.initialSpawn);});Properties
Section titled “Properties”player
Section titled “player”read-only
readonly player: Player;Types
initialSpawn
Section titled “initialSpawn”read-only
readonly initialSpawn: boolean;True when the player spawned on joining, false on respawning.
location
Section titled “location”read-only
readonly location: Vector3;Where their feet are.
Types
Used by
Section titled “Used by”WorldAfterEvents.playerSpawn, PlayerSpawnAfterEventSignal.subscribe, PlayerSpawnAfterEventSignal.unsubscribe