From a817715ad4f625e355b285d67ee323e8b2006ae4 Mon Sep 17 00:00:00 2001 From: Keuin Date: Mon, 25 Jan 2021 03:12:16 +0800 Subject: Code refactor --- src/main/java/com/keuin/kbackupfabric/KBCommands.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/keuin/kbackupfabric/KBCommands.java') diff --git a/src/main/java/com/keuin/kbackupfabric/KBCommands.java b/src/main/java/com/keuin/kbackupfabric/KBCommands.java index 01231be..fe5ea7f 100644 --- a/src/main/java/com/keuin/kbackupfabric/KBCommands.java +++ b/src/main/java/com/keuin/kbackupfabric/KBCommands.java @@ -87,6 +87,8 @@ public final class KBCommands { * @return stat code. */ public static int list(CommandContext context) { + // lazy: it just works as expected. Don't try to refactor, it's a waste of time. Just improve display and + // that's enough. // TODO: Show real name and size and etc info for incremental backup // TODO: Show concrete info from metadata for `.zip` backup MinecraftServer server = context.getSource().getMinecraftServer(); @@ -288,7 +290,7 @@ public final class KBCommands { // configure backup method MinecraftServer server = context.getSource().getMinecraftServer(); ConfiguredBackupMethod method = !incremental ? new ConfiguredPrimitiveBackupMethod( - new PrimitiveBackupFileNameEncoder().encode(customBackupName, LocalDateTime.now()), + PrimitiveBackupFileNameEncoder.INSTANCE.encode(customBackupName, LocalDateTime.now()), getLevelPath(server), getBackupSaveDirectory(server).getCanonicalPath() ) : new ConfiguredIncrementalBackupMethod( @@ -396,7 +398,7 @@ public final class KBCommands { private static String getPrimitiveBackupInformationString(String backupFileName, long backupFileSizeBytes) { return String.format( "(ZIP) %s , size: %s", - new PrimitiveBackupFileNameEncoder().decode(backupFileName), + PrimitiveBackupFileNameEncoder.INSTANCE.decode(backupFileName), getFriendlyFileSizeString(backupFileSizeBytes) ); } -- cgit v1.2.3