try { OutputStream os = new FileOutputStream(file.getAbsolutePath()); NBTOutputStream n = new NBTOutputStream(os); Tag tag = new StringTag("Data.LevelName", "test"); n.writeTag(tag); n.close(); System.out.println("[World Reset] Successfully edited level.dat..."); } catch (IOException e) { System.out.println("[World Reset] Failed to edit level.dat...") }