9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-31 12:56:28 +00:00

添加定时保存

This commit is contained in:
XiaoMoMi
2025-04-24 23:04:31 +08:00
parent 8a912a6a33
commit e2cbf00c98
7 changed files with 30 additions and 9 deletions

View File

@@ -200,7 +200,9 @@ public class BukkitWorldManager implements WorldManager, Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onWorldSave(WorldSaveEvent event) {
// TODO Timely saving?
for (CEWorld world : this.worldArray) {
world.save();
}
}
@Override
@@ -275,7 +277,7 @@ public class BukkitWorldManager implements WorldManager, Listener {
CEChunk ceChunk = world.getChunkAtIfLoaded(chunk.getX(), chunk.getZ());
if (ceChunk != null) {
try {
world.worldDataStorage().writeChunkAt(pos, ceChunk);
world.worldDataStorage().writeChunkAt(pos, ceChunk, false);
} catch (IOException e) {
this.plugin.logger().warn("Failed to write chunk tag at " + chunk.getX() + " " + chunk.getZ(), e);
} finally {