Old backups now will be deleted after being restored

2.x-1.16
szymon 2020-08-14 20:37:40 +02:00
parent 3d4867519c
commit 9877fe5c2c
2 changed files with 10 additions and 0 deletions

View File

@ -54,6 +54,9 @@ public class ConfigHandler {
"Be very careful when setting it, as it is easy corrupt your world!\n")
public Set<String> fileBlacklist = new HashSet<>();
@Comment("\nShould backups be deleted after being restored?\n")
public boolean deleteOldBackupAfterRestore = true;
@Comment("\nMaximum number of backups to keep. If set to 0 then no backup will be deleted based their amount\n")
public int backupsToKeep = 10;

View File

@ -74,6 +74,13 @@ public class RestoreBackupRunnable implements Runnable {
GenericTarDecompressor.decompress(backupFile, worldFile);
}
if(Statics.CONFIG.deleteOldBackupAfterRestore) {
Statics.LOGGER.info("Deleting old backup");
if(!backupFile.delete())
Statics.LOGGER.info("Something went wrong while deleting old backup");
}
Statics.LOGGER.info("Done!");
}