Skip to content

DrainPlayerFromWorldEvent

Package: com.hypixel.hytale.server.core.event.events.player Implements: IEvent<String> Cancellable: No

Standard event dispatched when a player leaves a world. This fires during world transfers and as part of the disconnect sequence. The world and transform fields are mutable, allowing listeners to override the destination world and the player’s position/rotation when they arrive.

FieldTypeAccessorMutableNullable
holderHolder<EntityStore>getHolder()NoNo
worldWorldgetWorld()YesNo
transformTransformgetTransform()YesYes
  • holder — The entity holder for the player leaving the world.
  • world — The world context. Mutable via setWorld(@Nonnull World) — can be overridden to control destination.
  • transform — The player’s position and rotation. May be null. Mutable via setTransform(@Nullable Transform) — can be overridden to control where the player appears next.
  • World.drainPlayer() (line 941) via eventBus dispatchFor — EventBus keyed dispatch when a player leaves a world.
// Listen globally for all world departures
getEventRegistry().registerGlobal(DrainPlayerFromWorldEvent.class, event -> {
World world = event.getWorld();
Transform transform = event.getTransform();
// Handle player leaving a world
});