diff options
author | Keuin <[email protected]> | 2021-01-13 12:51:15 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-13 12:51:15 +0800 |
commit | 81497ebee2cdb0dac3bcdc26c5d77d06bdb98b5d (patch) | |
tree | 9e7aad680a438b845126b266374155c8fb306179 /src/main/java/com/keuin/kbackupfabric/util/backup/suggestion | |
parent | f4d926c1eb91749a4b0f89c7a35538821ff7e21b (diff) |
Clean old incremental backup codes.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util/backup/suggestion')
2 files changed, 1 insertions, 38 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/suggestion/BackupMethodSuggestionProvider.java b/src/main/java/com/keuin/kbackupfabric/util/backup/suggestion/BackupMethodSuggestionProvider.java deleted file mode 100644 index 320d9bf..0000000 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/suggestion/BackupMethodSuggestionProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.keuin.kbackupfabric.util.backup.suggestion; - -import com.keuin.kbackupfabric.util.backup.BackupType; -import com.mojang.brigadier.suggestion.SuggestionProvider; -import com.mojang.brigadier.suggestion.Suggestions; -import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import net.minecraft.server.command.ServerCommandSource; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.concurrent.CompletableFuture; - -public class BackupMethodSuggestionProvider { - - private static final List<String> suggestions = Arrays.asList( - BackupType.OBJECT_TREE_BACKUP.getName(), - BackupType.PRIMITIVE_ZIP_BACKUP.getName() - ); // All backup methods - - public static SuggestionProvider<ServerCommandSource> getProvider() { - return (context, builder) -> getCompletableFuture(builder); - } - - private static CompletableFuture<Suggestions> getCompletableFuture(SuggestionsBuilder builder) { - String remaining = builder.getRemaining().toLowerCase(Locale.ROOT); - for (String string : suggestions) { // Iterate through the supplied list - if (string.toLowerCase(Locale.ROOT).startsWith(remaining)) { - builder.suggest(string); // Add every single entry to suggestions list. - } - } - return builder.buildFuture(); // Create the CompletableFuture containing all the suggestions - } - -} diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/suggestion/BackupNameSuggestionProvider.java b/src/main/java/com/keuin/kbackupfabric/util/backup/suggestion/BackupNameSuggestionProvider.java index f6f4056..01152c2 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/suggestion/BackupNameSuggestionProvider.java +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/suggestion/BackupNameSuggestionProvider.java @@ -1,6 +1,5 @@ package com.keuin.kbackupfabric.util.backup.suggestion; -import com.keuin.kbackupfabric.util.backup.BackupFilesystemUtil; import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; @@ -38,7 +37,7 @@ public class BackupNameSuggestionProvider { if (files == null) return; for (File f : files) - candidateCacheList.add(BackupFilesystemUtil.getBackupName(f.getName())); + candidateCacheList.add(f.getName()); cacheUpdateTime = System.currentTimeMillis(); } catch (NullPointerException ignored) { } |