Package valorless.rarespawns.events
Class UpdateEvent
java.lang.Object
valorless.rarespawns.events.UpdateEvent
- All Implemented Interfaces:
org.bukkit.event.Listener
Listener responsible for re-initializing and maintaining state for rare entities
when chunks load and when players join or teleport. Ensures entity metadata,
abilities, and associated scheduler tasks are correctly restored and that
the entity cache is populated for nearby rare entities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()Registers this listener with the Bukkit plugin manager.voidonChunkLoad(org.bukkit.event.world.ChunkLoadEvent event) When a chunk loads, scan for known rare entities and make sure their runnable tasks and data are back in a consistent state.voidonPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) Delay updating nearby entities briefly after a player joins so their chunks are loaded and entities are available to process.voidonPlayerTeleport(org.bukkit.event.player.PlayerTeleportEvent event) Delay updating nearby entities briefly after a player teleports to ensure the destination chunk/entities are ready.voidUpdateEntities(org.bukkit.entity.Player player) Re-apply non-initializing updates to nearby rare entities around a player and cache them.
-
Constructor Details
-
UpdateEvent
public UpdateEvent()
-
-
Method Details
-
init
public static void init()Registers this listener with the Bukkit plugin manager. Invoke during plugin enable. -
onChunkLoad
public void onChunkLoad(org.bukkit.event.world.ChunkLoadEvent event) When a chunk loads, scan for known rare entities and make sure their runnable tasks and data are back in a consistent state. Also re-add to cache.- Parameters:
event- chunk load event
-
onPlayerJoin
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) Delay updating nearby entities briefly after a player joins so their chunks are loaded and entities are available to process.- Parameters:
event- player join event
-
onPlayerTeleport
public void onPlayerTeleport(org.bukkit.event.player.PlayerTeleportEvent event) Delay updating nearby entities briefly after a player teleports to ensure the destination chunk/entities are ready.- Parameters:
event- player teleport event
-
UpdateEntities
public void UpdateEntities(org.bukkit.entity.Player player) Re-apply non-initializing updates to nearby rare entities around a player and cache them. This restores tasks/abilities/metadata that might have been lost due to chunk unloads or server restarts. Search box is asymmetric to favor vertical reach (100 x 1000 x 100).- Parameters:
player- the focal player
-