Package com.burchard36.api.command
Class ApiCommand
java.lang.Object
org.bukkit.command.Command
com.burchard36.api.command.ApiCommand
- All Implemented Interfaces:
org.bukkit.command.TabCompleter
public class ApiCommand
extends org.bukkit.command.Command
implements org.bukkit.command.TabCompleter
The class you want to use when registering commands.
You are meant to extend this class
- Since:
- 2.1.5
- Author:
- Dalton Burchard
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OnConsoleSenderprotected OnPlayerSenderprotected OnTabCompleteFields inherited from class org.bukkit.command.Command
description, timings, usageMessage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanonConsoleSender(OnConsoleSender sender)Sets the function to run when aConsoleCommandSendersends a commandonPlayerSender(OnPlayerSender sender)Sets the function to run when aPlayersends a commandonTabComplete(OnTabComplete onComplete)Executes a TabCompleter for this command, only usage if you set aOnPlayerSenderinterface usingonPlayerSenderonTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args)setCommandAliases(String... aliases)Sets the aliases of this commandsetCommandDescription(String newDesc)Sets the description of this commandsetCommandName(String newName)Sets the command name when executing eg /setCommandUsage(String usage)Sets the Command usage message for this commandMethods inherited from class org.bukkit.command.Command
broadcastCommandMessage, broadcastCommandMessage, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getUsage, isRegistered, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, tabComplete, tabComplete, testPermission, testPermissionSilent, toString, unregister
-
Field Details
-
onPlayerSender
-
onConsoleSender
-
onTabComplete
-
-
Constructor Details
-
ApiCommand
public ApiCommand()
-
-
Method Details
-
execute
public boolean execute(@Nonnull org.bukkit.command.CommandSender sender, @Nonnull String commandLabel, @Nonnull String[] args)- Specified by:
executein classorg.bukkit.command.Command
-
onPlayerSender
Sets the function to run when aPlayersends a command- Parameters:
sender- AOnPlayerSenderlambda interface- Returns:
- instance of this
ApiCommand - Since:
- 2.1.5
-
onConsoleSender
Sets the function to run when aConsoleCommandSendersends a command- Parameters:
sender- AOnConsoleSenderlambda interface- Returns:
- instance of this
ApiCommand - Since:
- 2.1.5
-
onTabComplete
Executes a TabCompleter for this command, only usage if you set aOnPlayerSenderinterface usingonPlayerSender- Parameters:
onComplete- AOnTabCompletefunctional interface lambda- Returns:
- instance of this
ApiCommand - Since:
- 2.1.5
-
setCommandName
Sets the command name when executing eg /- Parameters:
newName- AStringwithout spaces- Returns:
- instance of this
ApiCommand - Since:
- 2.1.5
-
setCommandDescription
Sets the description of this command- Parameters:
newDesc- AnyString- Returns:
- instance of this ApiCommand
- Since:
- 2.1.5
-
setCommandUsage
Sets the Command usage message for this command- Parameters:
usage-Stringto set usage message to- Returns:
- instance of this
ApiCommand - Since:
- 2.1.5
-
setCommandAliases
Sets the aliases of this command- Parameters:
aliases- Varargs ofString's, no strings with spaces- Returns:
- instance of this
ApiCommand - Since:
- 2.1.5
-
onTabComplete
public List<String> onTabComplete(@Nonnull org.bukkit.command.CommandSender sender, @Nonnull org.bukkit.command.Command command, @Nonnull String label, @Nonnull String[] args)- Specified by:
onTabCompletein interfaceorg.bukkit.command.TabCompleter
-