AddPlayerToWorldEvent
Package:
com.hypixel.hytale.server.core.event.events.playerImplements:IEvent<String>Cancellable: No
Standard event dispatched when a player enters a world. This fires both during the initial connection flow (after PlayerConnectEvent) and whenever a player is transferred between worlds.
The broadcastJoinMessage field controls whether a join message is broadcast to other players in the world. It defaults to true and can be set to false to suppress the message.
Fields / Accessors
Section titled “Fields / Accessors”| Field | Type | Accessor | Mutable | Nullable |
|---|---|---|---|---|
holder | Holder<EntityStore> | getHolder() | No | No |
world | World | getWorld() | No | No |
broadcastJoinMessage | boolean | shouldBroadcastJoinMessage() | Yes | No |
- holder — The entity holder for the player entering the world.
- world — The world the player is entering.
- broadcastJoinMessage — Whether to broadcast a join message. Default:
true. Mutable viasetBroadcastJoinMessage(boolean).
Fired By
Section titled “Fired By”World.addPlayer()(line 810) viaeventBus dispatchFor— EventBus keyed dispatch when a player enters a world.
Listening
Section titled “Listening”// Listen globally for all world joinsgetEventRegistry().registerGlobal(AddPlayerToWorldEvent.class, event -> { World world = event.getWorld(); boolean announce = event.shouldBroadcastJoinMessage();
// Example: suppress join messages in specific worlds if (isQuietWorld(world)) { event.setBroadcastJoinMessage(false); }});Related Events
Section titled “Related Events”DrainPlayerFromWorldEvent— The counterpart event fired when a player leaves a world.PlayerConnectEvent— Fired before this event during the initial connection flow.PlayerReadyEvent— Fired after this event when the player signals readiness.
Connection Flow
Section titled “Connection Flow”PlayerSetupConnectEvent --> PlayerConnectEvent --> AddPlayerToWorldEvent --> PlayerReadyEvent