Package dev.majek.pc.util
Class TabCompleterBase
- java.lang.Object
-
- dev.majek.pc.util.TabCompleterBase
-
- All Implemented Interfaces:
org.bukkit.command.TabCompleter
public abstract class TabCompleterBase extends Object implements org.bukkit.command.TabCompleter
Allows for some static utility methods to be available to tab completer.
-
-
Constructor Summary
Constructors Constructor Description TabCompleterBase()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<String>
filterStartingWith(String prefix, Collection<String> strings)
Filters the given string list by removing null or empty strings, or strings who do not start with the given prefix (ignoring case).static List<String>
filterStartingWith(String prefix, Stream<String> stream)
Filters the given stream by removing null or empty strings, or strings who do not start with the given prefix (ignoring case).static List<String>
getOnlinePlayers(String partialName)
Returns a list of the currently online players whose name starts with the given partial name.static String
joinArgsBeyond(int index, String delim, String[] args)
Joins all the arguments after the argument at the given index with the given delimiter.
-
-
-
Method Detail
-
getOnlinePlayers
public static List<String> getOnlinePlayers(String partialName)
Returns a list of the currently online players whose name starts with the given partial name.- Parameters:
partialName
- the partial name.- Returns:
- a list of the currently online players whose name starts with the given partial name.
-
joinArgsBeyond
public static String joinArgsBeyond(int index, String delim, String[] args)
Joins all the arguments after the argument at the given index with the given delimiter.- Parameters:
index
- the index.delim
- the delimiter.args
- the arguments.- Returns:
- the result of joining the argument after the given index with the given delimiter.
-
filterStartingWith
public static List<String> filterStartingWith(String prefix, Stream<String> stream)
Filters the given stream by removing null or empty strings, or strings who do not start with the given prefix (ignoring case).- Parameters:
prefix
- the prefix to match.stream
- the stream to filter.- Returns:
- the list of values left after the stream has been filtered.
-
filterStartingWith
public static List<String> filterStartingWith(String prefix, Collection<String> strings)
Filters the given string list by removing null or empty strings, or strings who do not start with the given prefix (ignoring case). This method is equivalent to calling filterStartingWith(prefix, strings.stream()).- Parameters:
prefix
- the prefix to match.strings
- the strings to filter.- Returns:
- the list of values left after the strings have been filtered.
-
-