Class CommandHandler

java.lang.Object
me.github.simonplays15.betterbansystem.spigot.CommandHandler
All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter

public class CommandHandler extends Object implements org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter
The CommandHandler class handles the execution of commands and tab completions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    The CommandHandler class handles the registration of commands and sets default command handlers for unregistered commands.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    onCommand (@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, @NotNull String[] args)
    Executes the command when it is called by a sender.
    @Nullable List<String>
    onTabComplete (@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, @NotNull String[] args)
    Provides tab completion for a command.

    Methods inherited from class java.lang.Object

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

    • CommandHandler

      public CommandHandler()
      The CommandHandler class handles the registration of commands and sets default command handlers for unregistered commands.
  • Method Details

    • onCommand

      public boolean onCommand (@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command, @NotNull @NotNull String label, @NotNull @NotNull String[] args)
      Executes the command when it is called by a sender.
      Specified by:
      onCommand in interface org.bukkit.command.CommandExecutor
      Parameters:
      sender - the command sender
      command - the command that is being executed
      label - the command label
      args - the command arguments
      Returns:
      true if the command was successfully executed, false otherwise
    • onTabComplete

      @Nullable public @Nullable List<String> onTabComplete (@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command, @NotNull @NotNull String label, @NotNull @NotNull String[] args)
      Provides tab completion for a command.
      Specified by:
      onTabComplete in interface org.bukkit.command.TabCompleter
      Parameters:
      sender - The CommandSender who is performing the tab completion.
      command - The command being tab completed.
      label - The alias or label used to invoke the command.
      args - The arguments provided for the command.
      Returns:
      A List of tab completion options for the command arguments, or null if tab completion is not available for the command.