Class CompleterHelper
java.lang.Object
me.despical.commandframework.utils.CompleterHelper
- Author:
- Despical
Created at 2.12.2025
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Collection<String>>
TcopyMatches(int index, @NotNull Iterable<String> originals, T collection) Copies all elements from the iterable collection of originals to the collection provided.<T extends Collection<String>>
TcopyMatches(@NotNull String token, @NotNull Iterable<String> originals, T collection) Copies all elements from the iterable collection of originals to the collection provided.Retrieves the names of all currently online players on the server.
-
Constructor Details
-
CompleterHelper
-
-
Method Details
-
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 fororiginals- 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 nullIllegalArgumentException- 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 fororiginals- 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 nullIllegalArgumentException- if originals contains a null element. Note: the collection may be modified before this is thrown
-