summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/KBCommands.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-25 03:12:16 +0800
committerkeuin <[email protected]>2021-01-25 03:12:16 +0800
commita817715ad4f625e355b285d67ee323e8b2006ae4 (patch)
tree5f9ffa5b18152b7efc056e5b01f9126505b69179 /src/main/java/com/keuin/kbackupfabric/KBCommands.java
parent93494e7e04e05beb4f07cfabdd14c674b97a12e5 (diff)
Code refactor
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/KBCommands.java')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/KBCommands.java6
1 files changed, 4 insertions, 2 deletions
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<ServerCommandSource> 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)
);
}