diff options
author | Keuin <[email protected]> | 2020-04-24 11:55:18 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2020-04-24 11:55:18 +0800 |
commit | b692a73e039fbdb404ef1219785660dc9eb60e60 (patch) | |
tree | 598351d6fcf5f4dcad0212e4cca37ffc16966e0d /src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java | |
parent | 87f5cd97ab22b17a948eb9af1b49a0b1e777048d (diff) |
Added /kb delete <backup_name> for deleting an backup (with auto-complete supported).
Command /kb confirm now confirms both /kb restore and /kb delete.
Added /kb prev for easily check out the latest backup.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java b/src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java index 57e59fb..3303f70 100644 --- a/src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java +++ b/src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java @@ -56,9 +56,9 @@ public final class BackupWorker implements Runnable { }); // Force to save all player data and worlds - LOGGER.debug("Saving players ..."); + LOGGER.info("Saving players ..."); server.getPlayerManager().saveAllPlayerData(); - LOGGER.debug("Saving worlds ..."); + LOGGER.info("Saving worlds ..."); server.save(true, true, true); // Start threaded worker @@ -86,6 +86,7 @@ public final class BackupWorker implements Runnable { String levelPath = getLevelPath(server); String backupFileName = getBackupFileName(backupName); LOGGER.debug(String.format("zip(srcPath=%s, destPath=%s)", levelPath, backupSaveDirectoryFile.toString())); + LOGGER.info("Compressing level ..."); ZipUtil.makeBackupZip(levelPath, backupSaveDirectoryFile.toString(), backupFileName, backupMetadata); File backupZipFile = new File(backupSaveDirectoryFile, backupFileName); @@ -96,11 +97,7 @@ public final class BackupWorker implements Runnable { long timeEscapedMillis = System.currentTimeMillis() - startTime; msgInfo(context, String.format("Backup finished. (%.2fs)", timeEscapedMillis / 1000.0), true); try { - double fileSize = backupZipFile.length() * 1.0 / 1024 / 1024; - if (fileSize > 1000) - msgInfo(context, String.format("File size: %.2fGB", fileSize / 1024)); - else - msgInfo(context, String.format("File size: %.2fMB", fileSize)); + msgInfo(context, String.format("File size: %s", humanFileSize(backupZipFile.length()))); } catch (SecurityException ignored) { } |