Progress towards #515
Fixes #512
Fixes #514
Fixes (possibly) #529
Fixes #535
Update to latest sponge
This commit is contained in:
boy0001
2015-08-11 20:45:13 +10:00
parent b77b550e56
commit 1a9ec84a4d
23 changed files with 391 additions and 167 deletions

View File

@ -126,8 +126,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void onDisable() {
Bukkit.getScheduler().cancelTasks(this);
PS.get().disable();
Bukkit.getScheduler().cancelTasks(this);
THIS = null;
}

View File

@ -178,6 +178,8 @@ public class EntityWrapper {
this.x = loc.getX();
this.y = loc.getY();
this.z = loc.getZ();
System.out.print("ENTITY: " + entity.getType());
System.out.print("ENTITY: " + entity.getType().getTypeId());
this.id = entity.getType().getTypeId();
if (depth == 0) {
return;

View File

@ -494,12 +494,14 @@ public class BukkitChunkManager extends ChunkManager {
public static void restoreEntities(final World world, final int x_offset, final int z_offset) {
for (final EntityWrapper entity : entities) {
try {
System.out.print("RESTORING ENTITIE!: " + EntityType.fromId(entity.id));
entity.spawn(world, x_offset, z_offset);
} catch (final Exception e) {
PS.debug("Failed to restore entity (e): " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id));
e.printStackTrace();
}
}
entities.clear();
}
public static void restoreBlocks(final World world, final int x_offset, final int z_offset) {

View File

@ -12,6 +12,7 @@ import org.bukkit.World;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
@ -87,12 +88,20 @@ public class SendChunk {
}
}
if (unload) {
try {
chunk.unload(true, true);
}
catch (Exception e) {
e.printStackTrace();
}
TaskManager.runTask(new Runnable() {
@Override
public void run() {
try {
chunk.unload(true, true);
}
catch (Exception e) {
String worldname = chunk.getWorld().getName();
PS.debug("$4Could not save chunk: " + worldname + ";" + chunk.getX() + ";" + chunk.getZ());
PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
PS.debug("$3 - $4" + worldname + "/level.dat or " + worldname + "level_old.dat may be corrupt (try repairing or removing these)");
}
}
});
}
}