@Override public void a(WorldInfo worldinfo) { NBTTagCompound nbttagcompound = worldinfo.a(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.a("Data", (NBTBase) nbttagcompound); try { File file1 = new File(this.worldDir, "level.dat_new"); File file2 = new File(this.worldDir, "level.dat_old"); File file3 = new File(this.worldDir, "level.dat"); CompressedStreamTools.a(nbttagcompound1, (OutputStream) (new FileOutputStream(file1))); if (file2.exists()) { file2.delete(); } file3.renameTo(file2); if (file3.exists()) { file3.delete(); } file1.renameTo(file3); if (file1.exists()) { file1.delete(); } } catch (Exception exception) { exception.printStackTrace(); } }
public static WorldInfo getInfo(String worldname) { WorldInfo info = null; try { Tag t = getData(worldname); if (t != null) { info = new WorldInfo(); info.name = t.findTagByName("LevelName").getValue().toString(); info.seed = (Long) t.findTagByName("RandomSeed").getValue(); info.size = (Long) t.findTagByName("SizeOnDisk").getValue(); info.time = (Long) t.findTagByName("Time").getValue(); info.raining = ((Byte) t.findTagByName("raining").getValue()) != 0; info.thundering = ((Byte) t.findTagByName("thundering").getValue()) != 0; if (info.size == 0) info.size = getWorldSize(worldname); } } catch (Exception ex) { } World w = getWorld(worldname); if (w != null) { if (info == null) { info = new WorldInfo(); info.size = getWorldSize(worldname); } info.name = w.getName(); info.seed = w.getSeed(); info.time = w.getFullTime(); info.raining = w.hasStorm(); info.thundering = w.isThundering(); } return info; }