Class ClientCommandManager

java.lang.Object
com.tenio.common.logger.AbstractLogger
com.tenio.common.logger.SystemLogger
com.tenio.core.command.client.ClientCommandManager

@Component public final class ClientCommandManager extends com.tenio.common.logger.SystemLogger
The commands' management class.
Since:
0.5.0
  • Constructor Details

    • ClientCommandManager

      public ClientCommandManager()
  • Method Details

    • registerCommand

      public void registerCommand(Short code, AbstractClientCommandHandler command)
      Registers a command handler.
      Parameters:
      code - The command code
      command - The command handler
    • unregisterCommand

      public void unregisterCommand(Short code)
      Removes a registered command handler.
      Parameters:
      code - The command code
    • getHandlersAsList

      public List<AbstractClientCommandHandler> getHandlersAsList()
      Returns a list of all registered commands.
      Returns:
      all command handlers as a list
    • getHandlers

      public Map<Short,AbstractClientCommandHandler> getHandlers()
      Retrieves a map of all registered commands.
      Returns:
      a Map of all registered commands
    • getHandler

      public AbstractClientCommandHandler getHandler(Short code)
      Returns a handler by its code
      Parameters:
      code - The command code
      Returns:
      the command handler
    • invoke

      public void invoke(Short code, Player player, com.tenio.common.data.DataCollection message)
      Invokes a command handler with given arguments.
      Parameters:
      code - The messaged used to invoke the command
      player - The receiver which gets command from its client
      message - The message as command
    • clear

      public void clear()
      Clears all the list of commands.