The PlayerLeaveAfterEvent interface in @minecraft/server.
Interface in @minecraft/server
import type { PlayerLeaveAfterEvent } from '@minecraft/server';Subscribe to it with world.afterEvents.playerLeave.
Example
Section titled “Example”import { world, type PlayerLeaveAfterEvent } from '@minecraft/server';
world.afterEvents.playerLeave.subscribe((event: PlayerLeaveAfterEvent) => { console.log('playerLeave', event.playerId, event.playerName);});import { world } from '@minecraft/server';
world.afterEvents.playerLeave.subscribe((event) => { console.log('playerLeave', event.playerId, event.playerName);});Properties
Section titled “Properties”playerId
Section titled “playerId”read-only
readonly playerId: string;playerName
Section titled “playerName”read-only
readonly playerName: string;Used by
Section titled “Used by”WorldAfterEvents.playerLeave, PlayerLeaveAfterEventSignal.subscribe, PlayerLeaveAfterEventSignal.unsubscribe