Nullify the prisoners and cells before saving them.

This commit is contained in:
graywolf336 2014-01-21 16:14:26 -06:00
parent c956018d1e
commit 3ab751baa8

View File

@ -181,6 +181,8 @@ public class JailIO {
flat.set(node + "tps.free.yaw", j.getTeleportFree().getYaw()); flat.set(node + "tps.free.yaw", j.getTeleportFree().getYaw());
flat.set(node + "tps.free.pitch", j.getTeleportFree().getPitch()); flat.set(node + "tps.free.pitch", j.getTeleportFree().getPitch());
//Set all the cells to nothing, then we save each of them so no cells are left behind
flat.set(node + ".cells", null);
for(Cell c : j.getCells()) { for(Cell c : j.getCells()) {
String cNode = node + ".cells." + c.getName() + "."; String cNode = node + ".cells." + c.getName() + ".";
@ -223,6 +225,8 @@ public class JailIO {
} }
} }
//Null all the prisoners out before we save them again, this way no prisoners are left behind
flat.set(node + "prisoners", null);
for(Prisoner p : j.getPrisonersNotInCells()) { for(Prisoner p : j.getPrisonersNotInCells()) {
String pNode = node + "prisoners." + p.getName() + "."; String pNode = node + "prisoners." + p.getName() + ".";
flat.set(pNode + "muted", p.isMuted()); flat.set(pNode + "muted", p.isMuted());