use of org.bukkit.event.world.ChunkUnloadEvent 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());
}
});
}
use of org.bukkit.event.world.ChunkUnloadEvent in project Glowstone by GlowstoneMC.
the class GlowChunk method unload.
@Deprecated
public boolean unload(boolean save, boolean safe) {
safe = false;
if (!isLoaded()) {
return true;
}
if (safe && world.isChunkInUse(x, z)) {
return false;
}
if (save && !world.getChunkManager().performSave(this)) {
return false;
}
EventFactory.getInstance().callEvent(new ChunkUnloadEvent(this));
sections = null;
biomes = null;
heightMap = null;
blockEntities.clear();
if (save) {
for (GlowEntity entity : entities) {
entity.remove();
}
entities.clear();
}
return true;
}
use of org.bukkit.event.world.ChunkUnloadEvent 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());
}
});
}
Aggregations