Class TabCompletionContext

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

public class TabCompletionContext extends Object
Immutable input metadata for a parameter's completion provider.
  • Field Details

    • sender

      private final org.bukkit.command.CommandSender sender
    • player

      private final org.bukkit.entity.Player player
    • commandName

      private final String commandName
    • args

      private final String[] args
    • currentArgIndex

      private final int currentArgIndex
    • partialArg

      private final String partialArg
    • matchedMethod

      private final Method matchedMethod
    • parameterName

      private final String parameterName
    • executorInstance

      private final Object executorInstance
  • Constructor Details

    • TabCompletionContext

      public TabCompletionContext()
  • Method Details

    • getSender

      public org.bukkit.command.CommandSender getSender()
      Returns the requesting sender, including contexts built with the player setter.
      Returns:
      the sender, or null when none was supplied
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Returns the player when this completion originated from one.
      Returns:
      the player, or null for another sender kind
    • getCurrentInput

      public String getCurrentInput()
      Gets the current partial token.
      Returns:
      the partial token, or an empty string
    • inputStartsWith

      public boolean inputStartsWith(String prefix)
      Checks the current token's prefix without case sensitivity.
      Parameters:
      prefix - the candidate prefix
      Returns:
      whether the token starts with that prefix
    • of

      public static TabCompletionContext of(org.bukkit.command.CommandSender sender, String commandName, String[] args)
      Creates a completion context without a Bukkit command object.
      Parameters:
      sender - the requesting sender
      commandName - the primary root label
      args - input tokens including the partial final token
      Returns:
      a new context