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
ConstructorsConstructorDescriptionThe CommandHandler class handles the registration of commands and sets default command handlers for unregistered commands. -
Method Summary
Modifier and TypeMethodDescriptionbooleanonCommand(@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.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.
-
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:
onCommandin interfaceorg.bukkit.command.CommandExecutor- Parameters:
sender- the command sendercommand- the command that is being executedlabel- the command labelargs- 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:
onTabCompletein interfaceorg.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.
-