diff options
author | Keuin <[email protected]> | 2020-07-25 14:17:39 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2020-07-25 14:17:39 +0800 |
commit | f09d420df609194a17e9d9ec63d710df8135aa8e (patch) | |
tree | 0594b992709f53b2cbcac85649949acb8c5ed0fe /src/main/java/com/keuin | |
parent | d50beeb1f082295f3ae9d4707c932ad2808f0568 (diff) |
Remove redundant mixin usage.
Small optimize for message in /kb list.
Diffstat (limited to 'src/main/java/com/keuin')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/KBCommands.java | 8 |
1 files changed, 7 insertions, 1 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<ServerCommandSource> 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; } |