Package baritone.api.command.helpers
Class TabCompleteHelper
java.lang.Object
baritone.api.command.helpers.TabCompleteHelper
The
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:
- Create a new instance with the empty constructor
- Use
append,prependoradd<something>methods to add completions - Sort using
sort(Comparator)orsortAlphabetically()and then filter by prefix usingfilterPrefix(String) - Get the stream using
stream() - Pass it up to whatever's calling your tab complete function (i.e.
ICommandManager.tabComplete(String)orIArgConsumer#tabCompleteDatatype(IDatatype)})
For advanced users: if you're intercepting TabCompleteEvents directly, use build() instead for an
array.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCommands(ICommandManager manager) Appends every command in the specifiedICommandManagerto thisTabCompleteHelperAppends every modified setting in theSettingsto thisTabCompleteHelperAppends every setting in theSettingsto thisTabCompleteHelperAppends all values of the specified enum to thisTabCompleteHelperand returns it for chainingAppends the specified strings to thisTabCompleteHelperand returns it for chainingAppends the specified stream to thisTabCompleteHelperand returns it for chainingString[]build()Apply the specifiedfilterto every element currently in thisTabCompleteHelperand return this object for chainingfilterPrefix(String prefix) Filter out any element that doesn't start withprefixand return this object for chainingfilterPrefixNamespaced(String prefix) Filter out any element that doesn't start withprefixand return this object for chainingApply the specifiedtransformto every element currently in thisTabCompleteHelperand return this object for chainingPrepends all values of the specified enum to thisTabCompleteHelperand returns it for chainingPrepends the specified strings to thisTabCompleteHelperand returns it for chainingPrepends the specified stream to thisTabCompleteHelperand returns it for chainingsort(Comparator<String> comparator) Apply the specifiedsortto every element currently in thisTabCompleteHelperand return this object for chainingSort every element currently in thisTabCompleteHelperalphabetically and return this object for chainingstream()
-
Constructor Details
-
TabCompleteHelper
-
TabCompleteHelper
-
TabCompleteHelper
public TabCompleteHelper()
-
-
Method Details
-
append
Appends the specified stream to thisTabCompleteHelperand returns it for chaining- Parameters:
source- The stream to append- Returns:
- This
TabCompleteHelperafter having appended the stream - See Also:
-
append
Appends the specified strings to thisTabCompleteHelperand returns it for chaining- Parameters:
source- The stream to append- Returns:
- This
TabCompleteHelperafter having appended the strings - See Also:
-
append
Appends all values of the specified enum to thisTabCompleteHelperand returns it for chaining- Parameters:
num- The enum to append the values of- Returns:
- This
TabCompleteHelperafter having appended the values - See Also:
-
prepend
Prepends the specified stream to thisTabCompleteHelperand returns it for chaining- Parameters:
source- The stream to prepend- Returns:
- This
TabCompleteHelperafter having prepended the stream - See Also:
-
prepend
Prepends the specified strings to thisTabCompleteHelperand returns it for chaining- Parameters:
source- The stream to prepend- Returns:
- This
TabCompleteHelperafter having prepended the strings - See Also:
-
prepend
Prepends all values of the specified enum to thisTabCompleteHelperand returns it for chaining- Parameters:
num- The enum to prepend the values of- Returns:
- This
TabCompleteHelperafter having prepended the values - See Also:
-
map
Apply the specifiedtransformto every element currently in thisTabCompleteHelperand return this object for chaining- Parameters:
transform- The transform to apply- Returns:
- This
TabCompleteHelper
-
filter
Apply the specifiedfilterto every element currently in thisTabCompleteHelperand return this object for chaining- Parameters:
filter- The filter to apply- Returns:
- This
TabCompleteHelper
-
sort
Apply the specifiedsortto every element currently in thisTabCompleteHelperand return this object for chaining- Parameters:
comparator- The comparator to use- Returns:
- This
TabCompleteHelper
-
sortAlphabetically
Sort every element currently in thisTabCompleteHelperalphabetically and return this object for chaining- Returns:
- This
TabCompleteHelper
-
filterPrefix
Filter out any element that doesn't start withprefixand return this object for chaining- Parameters:
prefix- The prefix to filter for- Returns:
- This
TabCompleteHelper
-
filterPrefixNamespaced
Filter out any element that doesn't start withprefixand return this object for chainingAssumes every element in this
TabCompleteHelperis aResourceLocation- Parameters:
prefix- The prefix to filter for- Returns:
- This
TabCompleteHelper
-
build
- Returns:
- An array containing every element in this
TabCompleteHelper - See Also:
-
stream
- Returns:
- A stream containing every element in this
TabCompleteHelper - See Also:
-
addCommands
Appends every command in the specifiedICommandManagerto thisTabCompleteHelper- Parameters:
manager- A command manager- Returns:
- This
TabCompleteHelper
-
addSettings
Appends every setting in theSettingsto thisTabCompleteHelper- Returns:
- This
TabCompleteHelper
-
addModifiedSettings
Appends every modified setting in theSettingsto thisTabCompleteHelper- Returns:
- This
TabCompleteHelper
-
addToggleableSettings
- Returns:
- This
TabCompleteHelper
-