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 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/keuin') 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; } -- cgit v1.2.3