Package com.avrix.commands
Class CommandsManager
java.lang.Object
com.avrix.commands.CommandsManager
A set of tools for handling custom commands
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addCommand
(Command command) Adding a command to the systemstatic String[]
getCommandArgs
(String chatCommand) Extracts command arguments from the given chat command.static String[]
getCommandArgs
(String commandPrefix, String chatCommand) Extracts command arguments from the given chat command with a specified prefix.Getting a map of registered user commandsstatic String
handleCustomCommand
(zombie.core.raknet.UdpConnection playerConnection, String chatCommand) Processing custom chat and console commands.
-
Constructor Details
-
CommandsManager
public CommandsManager()
-
-
Method Details
-
getRegisteredCommands
Getting a map of registered user commands- Returns:
Map
of registered commands. Key - command name, value - command instance
-
addCommand
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
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
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
-