WorldInterface world = main.getWorld();
if (!main.pathToGlobalState.exists()) main.pathToGlobalState.mkdirs();
if (!main.pathToWorldState.exists()) main.pathToGlobalState.mkdirs();
for (String name : stateHolders.keySet()) {
StateHolder h = stateHolders.get(name);
DataInputStream in = null;
try {
File f = new File(main.pathToGlobalState, name);
if (!f.exists()) h.resetCommonData();
else {
in = new DataInputStream(new FileInputStream(f));
h.readCommonData(in);
}
} finally {
if (in != null) in.close();
}
try {
File f = new File(main.pathToGlobalState, name);
if (!f.exists()) h.resetWorldData(world);
else {
in = new DataInputStream(new FileInputStream(f));
h.readWorldData(world, in);
}
} finally {
if (in != null) in.close();
}
}