Beispiel #1
0
  @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();
    }
  }