Skip to content

PlayerConnectEvent

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

Dispatched when a player entity has been created and the player is fully connected to the server. This event fires after the setup phase is complete (after PlayerSetupConnectEvent) and provides access to the player’s entity holder and reference.

The world field is mutable, allowing listeners to override which world the player initially spawns into. If set to null, the server uses its default world selection logic.

Because the key type is Void, this event is dispatched globally — all registered listeners receive it regardless of key.

FieldTypeAccessorMutableNotes
holderHolder<EntityStore>getHolder()NoThe entity holder for the connected player.
playerRefPlayerRefgetPlayerRef()NoReference to the connected player.
playerPlayergetPlayer()NoDeprecated. Use holder.getComponent(Player.getComponentType()) instead.
worldWorldgetWorld()YesThe world the player will be placed into. Nullable — mutable to override spawn world.
  • Dispatched by Universe (line 697) via eventBus.dispatchFor() when the player entity is created and connected. This fires after the setup phase completes and the player entity exists in the ECS.
getEventRegistry().register(PlayerConnectEvent.class, event -> {
PlayerRef playerRef = event.getPlayerRef();
World world = event.getWorld();
// Player entity is now available
});
  • PlayerSetupConnectEvent — fired before this event, during early connection before the player entity exists. Previous step in the connection flow.
  • PlayerDisconnectEvent — the counterpart event fired when the player disconnects after being fully connected.
  • AddPlayerToWorldEvent — fired after this event when the player enters a world. Next step in the connection flow.
PlayerSetupConnectEvent --> PlayerConnectEvent --> AddPlayerToWorldEvent --> PlayerReadyEvent