From f09d420df609194a17e9d9ec63d710df8135aa8e Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 25 Jul 2020 14:17:39 +0800 Subject: Remove redundant mixin usage. Small optimize for message in /kb list. --- src/main/java/com/keuin/kbackupfabric/KBCommands.java | 8 +++++++- src/main/resources/modid.mixins.json | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/keuin/kbackupfabric/KBCommands.java b/src/main/java/com/keuin/kbackupfabric/KBCommands.java index eb7e000..651a73e 100644 --- a/src/main/java/com/keuin/kbackupfabric/KBCommands.java +++ b/src/main/java/com/keuin/kbackupfabric/KBCommands.java @@ -74,13 +74,17 @@ public final class KBCommands { * @return stat code. */ public static int list(CommandContext context) { - msgInfo(context, "Available backups: (file is not checked, manipulation may affect this plugin)"); MinecraftServer server = context.getSource().getMinecraftServer(); File[] files = getBackupSaveDirectory(server).listFiles( (dir, name) -> dir.isDirectory() && name.toLowerCase().endsWith(".zip") && name.toLowerCase().startsWith(getBackupFileNamePrefix()) ); backupNameList.clear(); if (files != null) { + if (files.length != 0) { + msgInfo(context, "Available backups: (file is not checked, manipulation may affect this plugin)"); + } else { + msgInfo(context, "There are no available backups. To make a new backup, check /kb backup."); + } int i = 0; for (File file : files) { ++i; @@ -88,6 +92,8 @@ public final class KBCommands { backupNameList.add(backupName); msgInfo(context, String.format("[%d] %s, size: %.1fMB", i, backupName, file.length() * 1.0 / 1024 / 1024)); } + } else { + msgErr(context, "Error: failed to list files in backup folder."); } return SUCCESS; } diff --git a/src/main/resources/modid.mixins.json b/src/main/resources/modid.mixins.json index 21fe73a..351e221 100644 --- a/src/main/resources/modid.mixins.json +++ b/src/main/resources/modid.mixins.json @@ -6,7 +6,6 @@ "mixins": [ ], "client": [ - "ExampleMixin" ], "injectors": { "defaultRequire": 1 -- cgit v1.2.3