Skip to main content
World events are fired when worlds change state or chunks are loaded/unloaded. All world events extend the WorldEvent base class.

WorldEvent Base Class

All world events inherit from this class:
getWorld()
World
Returns the world involved in the event

World Lifecycle Events

Cancellable: NoCalled when a world is initialized (first loaded).
Cancellable: NoCalled when a world is loaded.
Cancellable: YesCalled when a world is about to be unloaded.
Cancellable: NoCalled when a world is saved to disk.

Chunk Events

Chunk events extend ChunkEvent which extends WorldEvent:
getChunkX()
int
Returns the chunk X coordinate
getChunkZ()
int
Returns the chunk Z coordinate
getChunk()
Chunk
Returns the chunk object
Cancellable: NoCalled when a chunk is loaded or newly generated.
Methods:
  • isNewChunk() - Returns true if chunk was newly generated, false if loaded from storage
Cancellable: YesCalled when a chunk is about to be unloaded.
Cancellable: NoCalled when a chunk is populated with decorations (trees, ores, etc.).

World Property Events

Cancellable: NoCalled when a world’s spawn position changes.
Methods:
  • getPreviousSpawn() - Returns the previous spawn position
Cancellable: NoCalled when a world’s difficulty changes.
Methods:
  • getOldDifficulty() - Returns the previous difficulty
  • getNewDifficulty() - Returns the new difficulty
Cancellable: NoCalled when a world’s display name changes.
Methods:
  • getOldName() - Returns the previous display name
  • getNewName() - Returns the new display name

Audio-Visual Events

Cancellable: YesCalled when a sound is played in a world.
Methods:
  • getSound() - Returns the Sound object
  • getPosition() - Returns the Vector3 position where sound plays
  • getRecipients() - Returns array of Players who will hear the sound
  • setRecipients(array $recipients) - Sets who will hear the sound
Cancellable: YesCalled when particles are spawned in a world.
Methods:
  • getParticle() - Returns the Particle object
  • getPosition() - Returns the Vector3 position where particles spawn
  • getRecipients() - Returns array of Players who will see particles
  • setRecipients(array $recipients) - Sets who will see particles

Usage Examples

Keeping Spawn Chunks Loaded

Custom Chunk Population

World Time Control

Sound Filtering

Complete World Event List

All world-related events:
  • ChunkEvent - Base class for chunk events
  • ChunkLoadEvent - Chunk is loaded or generated
  • ChunkPopulateEvent - Chunk is populated with decorations
  • ChunkUnloadEvent - Chunk is being unloaded
  • SpawnChangeEvent - World spawn position changes
  • WorldDifficultyChangeEvent - World difficulty changes
  • WorldDisplayNameChangeEvent - World display name changes
  • WorldEvent - Base class for world events
  • WorldInitEvent - World is initialized
  • WorldLoadEvent - World is loaded
  • WorldParticleEvent - Particles are spawned
  • WorldSaveEvent - World is saved
  • WorldSoundEvent - Sound is played
  • WorldUnloadEvent - World is being unloaded