Search in sources :

Example 1 with ChunkLoadEvent

use of org.bukkit.event.world.ChunkLoadEvent in project BKCommonLib by bergerhealer.

the class EntityAddRemoveHandler_1_8_to_1_13_2 method onEnabled.

@Override
public void onEnabled(CommonPlugin plugin) {
    super.onEnabled(plugin);
    plugin.register(new Listener() {

        @EventHandler(priority = EventPriority.LOWEST)
        public void onChunkLoad(ChunkLoadEvent event) {
            notifyChunkEntitiesLoaded(event.getChunk());
        }

        @EventHandler(priority = EventPriority.LOWEST)
        public void onChunkUnload(ChunkUnloadEvent event) {
            notifyChunkEntitiesUnloaded(event.getChunk());
        }
    });
}
Also used : ChunkUnloadEvent(org.bukkit.event.world.ChunkUnloadEvent) ChunkLoadEvent(org.bukkit.event.world.ChunkLoadEvent) Listener(org.bukkit.event.Listener) EventHandler(org.bukkit.event.EventHandler)

Example 2 with ChunkLoadEvent

use of org.bukkit.event.world.ChunkLoadEvent in project BKCommonLib by bergerhealer.

the class EntityAddRemoveHandler_1_14_to_1_16_5 method onEnabled.

@Override
public void onEnabled(CommonPlugin plugin) {
    super.onEnabled(plugin);
    plugin.register(new Listener() {

        @EventHandler(priority = EventPriority.LOWEST)
        public void onChunkLoad(ChunkLoadEvent event) {
            notifyChunkEntitiesLoaded(event.getChunk());
        }

        @EventHandler(priority = EventPriority.LOWEST)
        public void onChunkUnload(ChunkUnloadEvent event) {
            notifyChunkEntitiesUnloaded(event.getChunk());
        }
    });
}
Also used : ChunkUnloadEvent(org.bukkit.event.world.ChunkUnloadEvent) ChunkLoadEvent(org.bukkit.event.world.ChunkLoadEvent) Listener(org.bukkit.event.Listener) EventHandler(org.bukkit.event.EventHandler)

Aggregations

EventHandler (org.bukkit.event.EventHandler)2 Listener (org.bukkit.event.Listener)2 ChunkLoadEvent (org.bukkit.event.world.ChunkLoadEvent)2 ChunkUnloadEvent (org.bukkit.event.world.ChunkUnloadEvent)2