Class CommandsManager

java.lang.Object
com.avrix.commands.CommandsManager

public class CommandsManager extends Object
A set of tools for handling custom commands
  • Constructor Details

    • CommandsManager

      public CommandsManager()
  • Method Details

    • getRegisteredCommands

      public static Map<String,Command> getRegisteredCommands()
      Getting a map of registered user commands
      Returns:
      Map of registered commands. Key - command name, value - command instance
    • addCommand

      public static void addCommand(Command command)
      Adding a command to the system
      Parameters:
      command - chat command instance
    • handleCustomCommand

      public static String handleCustomCommand(zombie.core.raknet.UdpConnection playerConnection, String chatCommand)
      Processing custom chat and console commands.
      Parameters:
      playerConnection - player connection (null if command is executed from console).
      chatCommand - command entered by the player or console.
      Returns:
      output text to chat when calling a command or null if there is no such command.
    • getCommandArgs

      public static String[] getCommandArgs(String commandPrefix, String chatCommand)
      Extracts command arguments from the given chat command with a specified prefix.
      Parameters:
      commandPrefix - the prefix of the command (e.g., '!', '/', etc.)
      chatCommand - the full chat command string
      Returns:
      an array of command arguments, or null if the command is invalid
    • getCommandArgs

      public static String[] getCommandArgs(String chatCommand)
      Extracts command arguments from the given chat command.
      Parameters:
      chatCommand - the full chat command string
      Returns:
      an array of command arguments, or null if the command is invalid