From b692a73e039fbdb404ef1219785660dc9eb60e60 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 24 Apr 2020 11:55:18 +0800 Subject: Added /kb delete 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. --- .../java/com/keuin/kbackupfabric/worker/BackupWorker.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/main/java/com/keuin/kbackupfabric/worker/BackupWorker.java') 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) { } -- cgit v1.2.3