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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the access level required for the command from theCommandAccessLevelannotation.Retrieves the command name from theCommandNameannotation.Retrieves the command description from theCommandDescriptionannotation.Retrieves the execution scope of the command from theCommandExecutionScopeannotation.abstract StringPerforming 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 asnullargs- 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 theCommandNameannotation.- Returns:
- the command name, or
nullif the annotation is not present
-
getDescription
Retrieves the command description from theCommandDescriptionannotation.- Returns:
- the command description, or
nullif the annotation is not present
-
getAccessLevel
Retrieves the access level required for the command from theCommandAccessLevelannotation.- Returns:
- the required
AccessLevel, ornullif the annotation is not present
-
getExecutionScope
Retrieves the execution scope of the command from theCommandExecutionScopeannotation.- Returns:
- the
CommandScope, ornullif the annotation is not present
-