Class 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 Detail

      • TabCompleterBase

        public TabCompleterBase()
    • 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.