Package com.avrix.commands
Class Command
java.lang.Object
com.avrix.commands.Command
Interface for implementing a new command.
Implementing classes must use the
CommandName
annotation to specify the command name.
They may also use the CommandAccessLevel
annotation to specify the required access level for the command.
The CommandExecutionScope
annotation should be used to define where the command is available (e.g., in chat, in console, or both).
The CommandDescription
annotation can be used to add a description to the command, providing additional information about its functionality.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the access level required for the command from theCommandAccessLevel
annotation.Retrieves the command name from theCommandName
annotation.Retrieves the command description from theCommandDescription
annotation.Retrieves the execution scope of the command from theCommandExecutionScope
annotation.abstract String
Performing a chat command action
-
Constructor Details
-
Command
public Command()
-
-
Method Details
-
onInvoke
Performing a chat command action- Parameters:
playerConnection
-UdpConnection
, if called from the console, the connection will return asnull
args
- arguments of the received command- Returns:
- message text that will be displayed to the user (or console) when the command is executed
-
getCommandName
Retrieves the command name from theCommandName
annotation.- Returns:
- the command name, or
null
if the annotation is not present
-
getDescription
Retrieves the command description from theCommandDescription
annotation.- Returns:
- the command description, or
null
if the annotation is not present
-
getAccessLevel
Retrieves the access level required for the command from theCommandAccessLevel
annotation.- Returns:
- the required
AccessLevel
, ornull
if the annotation is not present
-
getExecutionScope
Retrieves the execution scope of the command from theCommandExecutionScope
annotation.- Returns:
- the
CommandScope
, ornull
if the annotation is not present
-