From 6e4b12cdf1f9b7fea617b54f0b7e0d083f4432a0 Mon Sep 17 00:00:00 2001 From: Tahg Date: Fri, 19 Aug 2011 23:17:48 -0400 Subject: [PATCH] safety check (and hopeful fix) for chunk saving --- src/main/java/net/minecraft/server/MinecraftServer.java | 5 ++--- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index c1f13d0c09..c232801a62 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -425,7 +425,7 @@ public class MinecraftServer implements Runnable, ICommandListener { Vec3D.a(); ++this.ticks; - ((CraftScheduler) this.server.getScheduler()).mainThreadHeartbeat(this.ticks); + ((CraftScheduler) this.server.getScheduler()).mainThreadHeartbeat(this.ticks); // CraftBukkit for (j = 0; j < this.worlds.size(); ++j) { // CraftBukkit // if (j == 0 || this.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit @@ -437,10 +437,9 @@ public class MinecraftServer implements Runnable, ICommandListener { EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(i); entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time } + // CraftBukkit end } - // CraftBukkit end - worldserver.doTick(); while (worldserver.doLighting()) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index ed09f0f33d..23d45a6df7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -153,7 +153,7 @@ public class CraftWorld implements World { net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z); - if (save) { + if (save && !chunk.isEmpty()) { chunk.removeEntities(); world.chunkProviderServer.saveChunk(chunk); world.chunkProviderServer.saveChunkNOP(chunk);