Class CompleterHelper

java.lang.Object
me.despical.commandframework.utils.CompleterHelper

public final class CompleterHelper extends Object
Author:
Despical

Created at 2.12.2025

  • Constructor Details

  • Method Details

    • playerNames

      @NotNull @Contract(pure=true) public @NotNull List<String> playerNames()
      Retrieves the names of all currently online players on the server.

      This method is useful for tab completion suggestions where a list of player names is required.

      Returns:
      An unmodifiable list containing the names of online players. Returns an empty list if no players are online. Never returns null.
    • copyMatches

      @NotNull @Contract(pure=true) public <T extends Collection<String>> T copyMatches(int index, @NotNull @NotNull Iterable<String> originals, @NotNull T collection)
      Copies all elements from the iterable collection of originals to the collection provided.
      Type Parameters:
      T - the collection of strings
      Parameters:
      index - Argument index to search for
      originals - An iterable collection of strings to filter.
      collection - The collection to add matches to
      Returns:
      the collection provided that would have the elements copied into
      Throws:
      UnsupportedOperationException - if the collection is immutable and originals contains a string which starts with the specified search string.
      IllegalArgumentException - if any parameter is null
      IllegalArgumentException - if originals contains a null element. Note: the collection may be modified before this is thrown
    • copyMatches

      @NotNull @Contract(pure=true) public <T extends Collection<String>> T copyMatches(@NotNull @NotNull String token, @NotNull @NotNull Iterable<String> originals, @NotNull T collection)
      Copies all elements from the iterable collection of originals to the collection provided.
      Type Parameters:
      T - the collection of strings
      Parameters:
      token - String to search for
      originals - An iterable collection of strings to filter.
      collection - The collection to add matches to
      Returns:
      the collection provided that would have the elements copied into
      Throws:
      UnsupportedOperationException - if the collection is immutable and originals contains a string which starts with the specified search string.
      IllegalArgumentException - if any parameter is null
      IllegalArgumentException - if originals contains a null element. Note: the collection may be modified before this is thrown