}
@Override
public Tag saveToNBT(Tag notused) {
timePlayed += (System.currentTimeMillis() - this.timeStartThisSesson);
Tag tag = new Tag(Tag.Type.TAG_Compound, new StringBuilder()
.append("WORLD_")
.append((this.name).toUpperCase().replaceAll(" ", "_"))
.toString(), new Tag[1]);
tag.addTag(new Tag(Tag.Type.TAG_String, "NAME", this.name));
tag.addTag(new Tag(Tag.Type.TAG_Long, "TIME_PLAYED", this.timePlayed));
tag.addTag(new Tag(Tag.Type.TAG_String, "STARTLEVEL", level.getName()));
tag.addTag(player.saveToNBT(new Tag(Tag.Type.TAG_Compound, "PLAYER",
new Tag[] { new Tag(Tag.Type.TAG_Int, "dump", 0) })));
// tag.addTag(game.level.saveToNBT(null));
Tag levels = new Tag(Tag.Type.TAG_Compound, "LEVELS",
new Tag[] { new Tag(Tag.Type.TAG_Int, "dump", 0) });
// Tag levels = new Tag("LEVELS", Tag.Type.TAG_Compound);
if (this.levels != null) {
for (Level l : this.levels) {
if (l != null) {
levels.addTag(l.saveToNBT(new Tag(Tag.Type.TAG_Compound, l
.getName().toUpperCase(), new Tag[] { new Tag(
Tag.Type.TAG_Int, "dump", 0) })));
}
}
} else {
levels.addTag(level.saveToNBT(null));
}
levels.addTag(new Tag(Tag.Type.TAG_End, null, null));
tag.addTag(levels);
tag.addTag(new Tag(Tag.Type.TAG_End, null, null));
return tag;
}