Skip to content

AddPlayerToWorldEvent

Package: com.hypixel.hytale.server.core.event.events.player Implements: 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.

FieldTypeAccessorMutableNullable
holderHolder<EntityStore>getHolder()NoNo
worldWorldgetWorld()NoNo
broadcastJoinMessagebooleanshouldBroadcastJoinMessage()YesNo
  • 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 via setBroadcastJoinMessage(boolean).
  • World.addPlayer() (line 810) via eventBus dispatchFor — EventBus keyed dispatch when a player enters a world.
// Listen globally for all world joins
getEventRegistry().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);
}
});
PlayerSetupConnectEvent --> PlayerConnectEvent --> AddPlayerToWorldEvent --> PlayerReadyEvent