diff options
author | Keuin <[email protected]> | 2020-04-24 13:10:00 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2020-04-24 13:10:00 +0800 |
commit | 59674ed29c6b2c7e8ac98fc4f0f4fd4fd6d437c9 (patch) | |
tree | 47730fe93306b41b68f29b86ef5d0860c0d53d42 /src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java | |
parent | 5749fc65909f0ee934d0410406265387157575a1 (diff) |
Implemented uniformed console output (log4j) in PrintUtil.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java b/src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java index 1e28324..be7734d 100644 --- a/src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java +++ b/src/main/java/com/keuin/kbackupfabric/operation/DeleteOperation.java @@ -1,10 +1,9 @@ package com.keuin.kbackupfabric.operation; +import com.keuin.kbackupfabric.util.PrintUtil; import com.mojang.brigadier.context.CommandContext; import net.minecraft.server.MinecraftServer; import net.minecraft.server.command.ServerCommandSource; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.io.File; import java.io.IOException; @@ -15,9 +14,9 @@ import static com.keuin.kbackupfabric.util.PrintUtil.msgErr; import static com.keuin.kbackupfabric.util.PrintUtil.msgInfo; import static org.apache.commons.io.FileUtils.forceDelete; -class DeleteOperation extends Confirmable { +class DeleteOperation extends AbstractConfirmableOperation { - private static final Logger LOGGER = LogManager.getLogger(); + //private static final Logger LOGGER = LogManager.getLogger(); private final String backupName; private final CommandContext<ServerCommandSource> context; @@ -30,13 +29,13 @@ class DeleteOperation extends Confirmable { public boolean confirm() { MinecraftServer server = context.getSource().getMinecraftServer(); String backupFileName = getBackupFileName(backupName); - LOGGER.info("Deleting backup " + backupName); + PrintUtil.info("Deleting backup " + backupName); File backupFile = new File(getBackupSaveDirectory(server), backupFileName); int tryCounter = 0; do { if (tryCounter == 5) { String msg = "Failed to delete file " + backupFileName; - LOGGER.error(msg); + PrintUtil.error(msg); msgErr(context, msg); return false; } @@ -47,7 +46,7 @@ class DeleteOperation extends Confirmable { } ++tryCounter; } while (backupFile.exists()); - LOGGER.info("Deleted backup " + backupName); + PrintUtil.info("Deleted backup " + backupName); msgInfo(context, "Deleted backup " + backupName); return true; } |