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 OnConsoleSender
protected OnPlayerSender
protected OnTabComplete
Fields inherited from class org.bukkit.command.Command
description, timings, usageMessage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
onConsoleSender(OnConsoleSender sender)
Sets the function to run when aConsoleCommandSender
sends a commandonPlayerSender(OnPlayerSender sender)
Sets the function to run when aPlayer
sends a commandonTabComplete(OnTabComplete onComplete)
Executes a TabCompleter for this command, only usage if you set aOnPlayerSender
interface usingonPlayerSender
onTabComplete(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:
execute
in classorg.bukkit.command.Command
-
onPlayerSender
Sets the function to run when aPlayer
sends a command- Parameters:
sender
- AOnPlayerSender
lambda interface- Returns:
- instance of this
ApiCommand
- Since:
- 2.1.5
-
onConsoleSender
Sets the function to run when aConsoleCommandSender
sends a command- Parameters:
sender
- AOnConsoleSender
lambda interface- Returns:
- instance of this
ApiCommand
- Since:
- 2.1.5
-
onTabComplete
Executes a TabCompleter for this command, only usage if you set aOnPlayerSender
interface usingonPlayerSender
- Parameters:
onComplete
- AOnTabComplete
functional interface lambda- Returns:
- instance of this
ApiCommand
- Since:
- 2.1.5
-
setCommandName
Sets the command name when executing eg /- Parameters:
newName
- AString
without 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
-String
to 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:
onTabComplete
in interfaceorg.bukkit.command.TabCompleter
-