diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java b/src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java index 72b5c73..9c0c1c2 100644 --- a/src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java +++ b/src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java @@ -6,7 +6,9 @@ import net.minecraft.server.command.ServerCommandSource; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; public class BackupNameSuggestionProvider { @@ -34,8 +36,10 @@ public class BackupNameSuggestionProvider { File[] files = file.listFiles(); if (files == null) return; - for (File f : files) - candidateCacheList.add(f.getName()); + Arrays.stream(files).map(File::getName).filter( + ((Predicate<String>) s -> s.toLowerCase().endsWith(".zip")) + .or(s -> s.toLowerCase().endsWith(".kbi")) + ).forEach(candidateCacheList::add); cacheUpdateTime = (int) System.currentTimeMillis(); } catch (NullPointerException ignored) { } |