Steps to reproduce:
Create a backup of a world
Open the backup and find that the last modified times of files inside are absent.
As a result, when replacing the original save with a backup, the time information, which indicates when a given area is touched for the last time and when a player joined the save for the last time, etc., would be lost.
Possible solution
Following is the vanilla implementation to add a file to a backup.
ZipEntry zipEntry = new ZipEntry(string);
zipOutputStream.putNextEntry(zipEntry);
com.google.common.io.Files.asByteSource(path.toFile()).copyTo(zipOutputStream);
zipOutputStream.closeEntry();
The ZipEntry class provides a few methods like setLastModifiedTime() to set the time information of corresponding files, by using them we can easily do it.
ZipEntry zipEntry = new ZipEntry(string);
zipEntry.setLastModifiedTime(Files.getLastModifiedTime(path));
// Then set the created & last accessed time...
zipOutputStream.putNextEntry(zipEntry); com.google.common.io.Files.asByteSource(path.toFile()).copyTo(zipOutputStream);
zipOutputStream.closeEntry();
Do you mean that the last modified date is reset to the current date and time for all backed up files?