Class TabCompleterBase

java.lang.Object
dev.majek.hexnicks.util.TabCompleterBase

public class TabCompleterBase extends Object
Handles some static utility methods available to tab completer.
  • Constructor Details

    • TabCompleterBase

      public TabCompleterBase()
  • Method Details

    • 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.