public class TabCompleteHelper extends java.lang.Object
TabCompleteHelper is a single-use object that helps you handle tab completion. It includes helper
methods for appending and prepending streams, sorting, filtering by prefix, and so on.
The recommended way to use this class is:
append, prepend or add<something> methods to add completionssort(Comparator) or sortAlphabetically() and then filter by prefix using
filterPrefix(String)stream()ICommandManager.tabComplete(String) or IArgConsumer#tabCompleteDatatype(IDatatype)})
For advanced users: if you're intercepting TabCompleteEvents directly, use build() instead for an
array.
| Constructor and Description |
|---|
TabCompleteHelper() |
TabCompleteHelper(java.util.List<java.lang.String> base) |
TabCompleteHelper(java.lang.String[] base) |
| Modifier and Type | Method and Description |
|---|---|
TabCompleteHelper |
addCommands(ICommandManager manager)
Appends every command in the specified
ICommandManager to this TabCompleteHelper |
TabCompleteHelper |
addModifiedSettings()
Appends every modified setting in the
Settings to this TabCompleteHelper |
TabCompleteHelper |
addSettings()
Appends every setting in the
Settings to this TabCompleteHelper |
TabCompleteHelper |
addToggleableSettings()
|
TabCompleteHelper |
append(java.lang.Class<? extends java.lang.Enum<?>> num)
Appends all values of the specified enum to this
TabCompleteHelper and returns it for chaining |
TabCompleteHelper |
append(java.util.stream.Stream<java.lang.String> source)
Appends the specified stream to this
TabCompleteHelper and returns it for chaining |
TabCompleteHelper |
append(java.lang.String... source)
Appends the specified strings to this
TabCompleteHelper and returns it for chaining |
java.lang.String[] |
build() |
TabCompleteHelper |
filter(java.util.function.Predicate<java.lang.String> filter)
Apply the specified
filter to every element currently in this TabCompleteHelper and return
this object for chaining |
TabCompleteHelper |
filterPrefix(java.lang.String prefix)
Filter out any element that doesn't start with
prefix and return this object for chaining |
TabCompleteHelper |
filterPrefixNamespaced(java.lang.String prefix)
Filter out any element that doesn't start with
prefix and return this object for chaining |
TabCompleteHelper |
map(java.util.function.Function<java.lang.String,java.lang.String> transform)
Apply the specified
transform to every element currently in this TabCompleteHelper and
return this object for chaining |
TabCompleteHelper |
prepend(java.lang.Class<? extends java.lang.Enum<?>> num)
Prepends all values of the specified enum to this
TabCompleteHelper and returns it for chaining |
TabCompleteHelper |
prepend(java.util.stream.Stream<java.lang.String> source)
Prepends the specified stream to this
TabCompleteHelper and returns it for chaining |
TabCompleteHelper |
prepend(java.lang.String... source)
Prepends the specified strings to this
TabCompleteHelper and returns it for chaining |
TabCompleteHelper |
sort(java.util.Comparator<java.lang.String> comparator)
Apply the specified
sort to every element currently in this TabCompleteHelper and return
this object for chaining |
TabCompleteHelper |
sortAlphabetically()
Sort every element currently in this
TabCompleteHelper alphabetically and return this object for
chaining |
java.util.stream.Stream<java.lang.String> |
stream() |
public TabCompleteHelper(java.lang.String[] base)
public TabCompleteHelper(java.util.List<java.lang.String> base)
public TabCompleteHelper()
public TabCompleteHelper append(java.util.stream.Stream<java.lang.String> source)
TabCompleteHelper and returns it for chainingsource - The stream to appendTabCompleteHelper after having appended the streamappend(String...),
append(Class)public TabCompleteHelper append(java.lang.String... source)
TabCompleteHelper and returns it for chainingsource - The stream to appendTabCompleteHelper after having appended the stringsappend(Stream),
append(Class)public TabCompleteHelper append(java.lang.Class<? extends java.lang.Enum<?>> num)
TabCompleteHelper and returns it for chainingnum - The enum to append the values ofTabCompleteHelper after having appended the valuesappend(Stream),
append(String...)public TabCompleteHelper prepend(java.util.stream.Stream<java.lang.String> source)
TabCompleteHelper and returns it for chainingsource - The stream to prependTabCompleteHelper after having prepended the streamprepend(String...),
prepend(Class)public TabCompleteHelper prepend(java.lang.String... source)
TabCompleteHelper and returns it for chainingsource - The stream to prependTabCompleteHelper after having prepended the stringsprepend(Stream),
prepend(Class)public TabCompleteHelper prepend(java.lang.Class<? extends java.lang.Enum<?>> num)
TabCompleteHelper and returns it for chainingnum - The enum to prepend the values ofTabCompleteHelper after having prepended the valuesprepend(Stream),
prepend(String...)public TabCompleteHelper map(java.util.function.Function<java.lang.String,java.lang.String> transform)
transform to every element currently in this TabCompleteHelper and
return this object for chainingtransform - The transform to applyTabCompleteHelperpublic TabCompleteHelper filter(java.util.function.Predicate<java.lang.String> filter)
filter to every element currently in this TabCompleteHelper and return
this object for chainingfilter - The filter to applyTabCompleteHelperpublic TabCompleteHelper sort(java.util.Comparator<java.lang.String> comparator)
sort to every element currently in this TabCompleteHelper and return
this object for chainingcomparator - The comparator to useTabCompleteHelperpublic TabCompleteHelper sortAlphabetically()
TabCompleteHelper alphabetically and return this object for
chainingTabCompleteHelperpublic TabCompleteHelper filterPrefix(java.lang.String prefix)
prefix and return this object for chainingprefix - The prefix to filter forTabCompleteHelperpublic TabCompleteHelper filterPrefixNamespaced(java.lang.String prefix)
prefix and return this object for chaining
Assumes every element in this TabCompleteHelper is a ResourceLocation
prefix - The prefix to filter forTabCompleteHelperpublic java.lang.String[] build()
TabCompleteHelperstream()public java.util.stream.Stream<java.lang.String> stream()
TabCompleteHelperbuild()public TabCompleteHelper addCommands(ICommandManager manager)
ICommandManager to this TabCompleteHelpermanager - A command managerTabCompleteHelperpublic TabCompleteHelper addSettings()
Settings to this TabCompleteHelperTabCompleteHelperpublic TabCompleteHelper addModifiedSettings()
Settings to this TabCompleteHelperTabCompleteHelperpublic TabCompleteHelper addToggleableSettings()
TabCompleteHelper