diff --git a/src/main/java/net/knarcraft/knarlib/util/TabCompletionHelper.java b/src/main/java/net/knarcraft/knarlib/util/TabCompletionHelper.java index 795910d..72f1c10 100644 --- a/src/main/java/net/knarcraft/knarlib/util/TabCompletionHelper.java +++ b/src/main/java/net/knarcraft/knarlib/util/TabCompletionHelper.java @@ -1,9 +1,11 @@ package net.knarcraft.knarlib.util; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; +import java.util.function.BiFunction; /** * Helper class for getting string lists required for auto-completion @@ -14,6 +16,51 @@ public final class TabCompletionHelper { private TabCompletionHelper() { } + /** + * Finds available tab-completions for a list where several comma-separated values are allowed + * + *
If, for example, the available values are [fish,potatoes,stew,strawberries], and the player has already typed + * "fish,potatoes,", then available tab-completions become fish,potatoes,stew and fish,potatoes,strawberries.
+ * + * @param valuesThe available tab-completion values
+ * @param typedTextThe text the player has typed
+ * @param filtererThe filterer (filterMatching) to use to filter by typed text
+ * @returnAvailable tab-completions
+ */ + public static @NotNull ListThe string arguments to get the base of
+ * @returnThe base string
+ */ + private static @NotNull String getBase(@NotNull List