Skip to content

World Events

Packages:

  • com.hypixel.hytale.server.core.universe.world.events
  • com.hypixel.hytale.server.core.universe.world.events.ecs

Events related to world and chunk lifecycle.


Fired when a world is added to the universe. This event is cancellable.

Class: com.hypixel.hytale.server.core.universe.world.events.AddWorldEvent

PropertyValue
ExtendsWorldEvent, ICancellable
KeyTypeString (world name)
CancellableYes
MethodReturn TypeDescription
getWorld()@Nonnull WorldReturns the world being added (inherited from WorldEvent)

Example (from TeleportPlugin, PortalsPlugin, BlockModule)

Section titled “Example (from TeleportPlugin, PortalsPlugin, BlockModule)”

The primary use case is registering map marker providers:

events.registerGlobal(AddWorldEvent.class, event -> {
event.getWorld().getWorldMapManager()
.addMarkerProvider("warps", WarpMarkerProvider.INSTANCE);
});

Fired when a world is removed. This event is cancellable (unless removal reason is EXCEPTIONAL).

Class: com.hypixel.hytale.server.core.universe.world.events.RemoveWorldEvent

PropertyValue
ExtendsWorldEvent, ICancellable
KeyTypeString (world name)
MethodReturn TypeDescription
getWorld()@Nonnull WorldReturns the world being removed (inherited from WorldEvent)
getRemovalReason()@Nonnull RemovalReasonReturns the reason for removal (GENERAL or EXCEPTIONAL)
ValueDescription
GENERALNormal world removal (cancellable)
EXCEPTIONALForced removal due to error (not cancellable)
events.registerGlobal(RemoveWorldEvent.class, event -> {
// disable portals pointing to this world
for (World otherWorld : Universe.get().getWorlds().values()) {
if (otherWorld == event.getWorld()) continue;
otherWorld.execute(() ->
PortalInvalidDestinationSystem.turnOffPortalsInWorld(otherWorld, event.getWorld())
);
}
});

Fired when a world starts its tick loop. This is the earliest point where the world is fully initialized — ECS stores, chunk loader/saver, and lighting are all ready.

Class: com.hypixel.hytale.server.core.universe.world.events.StartWorldEvent

PropertyValue
ExtendsWorldEvent
KeyTypeString (world name)
MethodReturn TypeDescription
getWorld()@Nonnull WorldReturns the world that started (inherited from WorldEvent)
PhaseWhat happensWhat’s available
World constructorChunkStore and EntityStore objects createdWorld object, WorldConfig
World.init()World generator loaded asynchronouslyWorld generator (IWorldGen)
Plugin start()All mods finished setupAssets, config, event registration — not world contents
World.onStart()chunkStore.start(), entityStore.start(), lighting startedEverything
StartWorldEventDispatched right after onStart()Everything — safe to access stores, loader, entities

Use this event to defer initialization that needs world contents:

getEventRegistry().registerGlobal(StartWorldEvent.class, event -> {
World world = event.getWorld();
// stores, loader, entities, lighting — all ready
initializeRenderer(world);
});

Fired once after all configured worlds have loaded during startup.

Class: com.hypixel.hytale.server.core.universe.world.events.AllWorldsLoadedEvent

PropertyValue
ImplementsIEvent<Void>
KeyTypeVoid

This event has no public methods besides toString().

events.registerGlobal(AllWorldsLoadedEvent.class, event -> {
loadWarps(); // load warps.json after all worlds are ready
});

Fired during chunk loading/generation. Implements IProcessedEvent.

Class: com.hypixel.hytale.server.core.universe.world.events.ChunkPreLoadProcessEvent

PropertyValue
ExtendsChunkEvent, IProcessedEvent
KeyTypeString (world name)
MethodReturn TypeDescription
getChunk()WorldChunkReturns the chunk being loaded (inherited from ChunkEvent)
isNewlyGenerated()booleanReturns true if the chunk was newly generated, false if loaded from disk
getHolder()Holder<ChunkStore>Returns the chunk storage holder
didLog()booleanReturns whether a performance warning was logged for this event
processEvent(String hookName)voidInternal method called after each handler to track timing
// spawn warp entities when their chunk loads
events.registerGlobal(ChunkPreLoadProcessEvent.class, event -> {
WorldChunk chunk = event.getChunk();
for (Warp warp : getWarpsInChunk(chunk)) {
spawnWarpEntity(warp, chunk);
}
});

Example (from FluidPlugin, BlockTickPlugin)

Section titled “Example (from FluidPlugin, BlockTickPlugin)”
// use priority to control processing order
events.registerGlobal(EventPriority.FIRST, ChunkPreLoadProcessEvent.class, event -> {
if (!event.isNewlyGenerated()) return; // only for new chunks
setupFluidTicking(event.getChunk());
});

Fired when a world’s file path changes (rare).

Class: com.hypixel.hytale.server.core.universe.world.path.WorldPathChangedEvent

PropertyValue
ImplementsIEvent<Void>
KeyTypeVoid
MethodReturn TypeDescription
getWorldPath()WorldPathReturns the new world path

Fired when a chunk is unloaded. This event is cancellable.

Class: com.hypixel.hytale.server.core.universe.world.events.ecs.ChunkUnloadEvent

PropertyValue
ExtendsCancellableEcsEvent
CancellableYes
MethodReturn TypeDescription
getChunk()@Nonnull WorldChunkReturns the chunk being unloaded
willResetKeepAlive()booleanReturns whether the keep-alive timer will be reset after unload (default: true)
setResetKeepAlive(boolean willResetKeepAlive)voidSets whether to reset the keep-alive timer

Fired when a chunk is saved. This event is cancellable.

Class: com.hypixel.hytale.server.core.universe.world.events.ecs.ChunkSaveEvent

PropertyValue
ExtendsCancellableEcsEvent
CancellableYes
MethodReturn TypeDescription
getChunk()@Nonnull WorldChunkReturns the chunk being saved

Fired when the moon phase changes.

Class: com.hypixel.hytale.server.core.universe.world.events.ecs.MoonPhaseChangeEvent

PropertyValue
ExtendsEcsEvent
MethodReturn TypeDescription
getNewMoonPhase()intReturns the new moon phase value