Class TabCompletionContext

java.lang.Object
com.ultikits.ultitools.commands.tabcomplete.TabCompletionContext

public class TabCompletionContext extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    private final String[]
    The current arguments typed by the player.
    private final org.bukkit.command.Command
    The command being completed.
    private final int
    The index of the current argument being completed (0-based).
    private final Object
    The command executor instance for invoking suggestion methods.
    private final Method
    The matched method for the current command format (may be null).
    private final String
    The parameter name being completed (from format like <paramName>).
    private final String
    The partial text of the current argument (may be empty).
    private final org.bukkit.entity.Player
    The player requesting completion.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the current partial argument or empty string if none.
    boolean
    Checks if the current input starts with the given prefix (case-insensitive).
    of(org.bukkit.entity.Player player, org.bukkit.command.Command command, String[] args)
    Creates a context from command arguments.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • player

      private final org.bukkit.entity.Player player
      The player requesting completion.
    • command

      private final org.bukkit.command.Command command
      The command being completed.
    • args

      private final String[] args
      The current arguments typed by the player.
    • currentArgIndex

      private final int currentArgIndex
      The index of the current argument being completed (0-based).
    • partialArg

      private final String partialArg
      The partial text of the current argument (may be empty).
    • matchedMethod

      private final Method matchedMethod
      The matched method for the current command format (may be null).
    • parameterName

      private final String parameterName
      The parameter name being completed (from format like <paramName>).
    • executorInstance

      private final Object executorInstance
      The command executor instance for invoking suggestion methods.
  • Constructor Details

    • TabCompletionContext

      public TabCompletionContext()
  • Method Details

    • getCurrentInput

      public String getCurrentInput()
      Gets the current partial argument or empty string if none.
      Returns:
      the partial argument being typed
    • inputStartsWith

      public boolean inputStartsWith(String prefix)
      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 player
      command - the command
      args - the arguments
      Returns:
      a new context