diff options
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java b/src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java index 444ca9a..3ae09f5 100644 --- a/src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java +++ b/src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java @@ -1,8 +1,8 @@ package com.keuin.kbackupfabric.operation; import com.keuin.kbackupfabric.operation.abstracts.InvokableAsyncBlockingOperation; -import com.keuin.kbackupfabric.util.backup.suggestion.BackupNameSuggestionProvider; import com.keuin.kbackupfabric.util.PrintUtil; +import com.keuin.kbackupfabric.util.backup.suggestion.BackupNameSuggestionProvider; import com.mojang.brigadier.context.CommandContext; import net.minecraft.server.MinecraftServer; import net.minecraft.server.command.ServerCommandSource; @@ -10,27 +10,26 @@ import net.minecraft.server.command.ServerCommandSource; import java.io.File; import java.io.IOException; -import static com.keuin.kbackupfabric.util.backup.BackupFilesystemUtil.getBackupFileName; -import static com.keuin.kbackupfabric.util.backup.BackupFilesystemUtil.getBackupSaveDirectory; import static com.keuin.kbackupfabric.util.PrintUtil.msgErr; import static com.keuin.kbackupfabric.util.PrintUtil.msgInfo; +import static com.keuin.kbackupfabric.util.backup.BackupFilesystemUtil.getBackupSaveDirectory; import static org.apache.commons.io.FileUtils.forceDelete; public class DeleteOperation extends InvokableAsyncBlockingOperation { //private static final Logger LOGGER = LogManager.getLogger(); - private final String backupName; + private final String backupFileName; private final CommandContext<ServerCommandSource> context; - public DeleteOperation(CommandContext<ServerCommandSource> context, String backupName) { + public DeleteOperation(CommandContext<ServerCommandSource> context, String backupFileName) { super("BackupDeletingWorker"); - this.backupName = backupName; + this.backupFileName = backupFileName; this.context = context; } @Override public String toString() { - return String.format("deletion of %s", backupName); + return String.format("deletion of %s", backupFileName); } @Override @@ -41,8 +40,7 @@ public class DeleteOperation extends InvokableAsyncBlockingOperation { private void delete() { MinecraftServer server = context.getSource().getMinecraftServer(); - String backupFileName = getBackupFileName(backupName); - PrintUtil.info("Deleting backup " + backupName); + PrintUtil.info("Deleting backup file " + this.backupFileName); File backupFile = new File(getBackupSaveDirectory(server), backupFileName); int tryCounter = 0; do { @@ -59,7 +57,7 @@ public class DeleteOperation extends InvokableAsyncBlockingOperation { } ++tryCounter; } while (backupFile.exists()); - PrintUtil.info("Deleted backup " + backupName); - msgInfo(context, "Deleted backup " + backupName); + PrintUtil.info("Successfully deleted backup file " + this.backupFileName); + msgInfo(context, "Successfully deleted backup file " + this.backupFileName); } } |