Class Command

java.lang.Object
com.avrix.commands.Command

public abstract class Command extends Object
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 Details

    • Command

      public Command()
  • Method Details

    • onInvoke

      public abstract String onInvoke(zombie.core.raknet.UdpConnection playerConnection, String[] args)
      Performing a chat command action
      Parameters:
      playerConnection - UdpConnection, if called from the console, the connection will return as null
      args - arguments of the received command
      Returns:
      message text that will be displayed to the user (or console) when the command is executed
    • getCommandName

      public String getCommandName()
      Retrieves the command name from the CommandName annotation.
      Returns:
      the command name, or null if the annotation is not present
    • getDescription

      public String getDescription()
      Retrieves the command description from the CommandDescription annotation.
      Returns:
      the command description, or null if the annotation is not present
    • getAccessLevel

      public AccessLevel getAccessLevel()
      Retrieves the access level required for the command from the CommandAccessLevel annotation.
      Returns:
      the required AccessLevel, or null if the annotation is not present
    • getExecutionScope

      public CommandScope getExecutionScope()
      Retrieves the execution scope of the command from the CommandExecutionScope annotation.
      Returns:
      the CommandScope, or null if the annotation is not present