Class TabCompletionContext
java.lang.Object
com.ultikits.ultitools.commands.tabcomplete.TabCompletionContext
Context object containing all information needed for tab completion.
Immutable and thread-safe.
- Since:
- 6.2.0
- Version:
- 1.0.0
- Author:
- wisdomme
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]The current arguments typed by the player.private final org.bukkit.command.CommandThe command being completed.private final intThe index of the current argument being completed (0-based).private final ObjectThe command executor instance for invoking suggestion methods.private final MethodThe matched method for the current command format (may be null).private final StringThe parameter name being completed (from format like <paramName>).private final StringThe partial text of the current argument (may be empty).private final org.bukkit.entity.PlayerThe player requesting completion. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the current partial argument or empty string if none.booleaninputStartsWith(String prefix) Checks if the current input starts with the given prefix (case-insensitive).static TabCompletionContextCreates a context from command arguments.
-
Field Details
-
player
private final org.bukkit.entity.Player playerThe player requesting completion. -
command
private final org.bukkit.command.Command commandThe command being completed. -
args
The current arguments typed by the player. -
currentArgIndex
private final int currentArgIndexThe index of the current argument being completed (0-based). -
partialArg
The partial text of the current argument (may be empty). -
matchedMethod
The matched method for the current command format (may be null). -
parameterName
The parameter name being completed (from format like <paramName>). -
executorInstance
The command executor instance for invoking suggestion methods.
-
-
Constructor Details
-
TabCompletionContext
public TabCompletionContext()
-
-
Method Details
-
getCurrentInput
Gets the current partial argument or empty string if none.- Returns:
- the partial argument being typed
-
inputStartsWith
Checks if the current input starts with the given prefix (case-insensitive).- Parameters:
prefix- the prefix to check- Returns:
- true if the current input starts with the prefix
-
of
public static TabCompletionContext of(org.bukkit.entity.Player player, org.bukkit.command.Command command, String[] args) Creates a context from command arguments.- Parameters:
player- the playercommand- the commandargs- the arguments- Returns:
- a new context
-