use of org.bukkit.event.world.WorldSaveEvent in project Glowstone by GlowstoneMC.
the class GlowWorld method save.
/**
* Saves world to disk synchronously or asynchronously.
*
* @param async if true, save asynchronously
*/
public void save(boolean async) {
EventFactory.getInstance().callEvent(new WorldSaveEvent(this));
// save metadata
writeWorldData(async);
// save chunkManager
maybeAsync(async, () -> {
for (GlowChunk chunk : chunkManager.getLoadedChunks()) {
chunkManager.performSave(chunk);
}
});
// save players
for (GlowPlayer player : getRawPlayers()) {
player.saveData(async);
}
}
Aggregations