public CommandListener
Provides an interface to listen for command execution, with the option to intercept the command and execute your own code instead.
Important performance note: CommandListeners are persistent through the entire game session, so be careful with your memory management!
Modifier and Type | Method and Description |
---|---|
BaseCommand.CommandResult |
execute()
Called when your CommandListener declares that it wants to take over execution of a command. This is only called if your listener returned
true during and was the highest priority listener to do so. |
void |
onPostExecute()
Called after a command is run, regardless of whether execution was intercepted by a CommandListener or not.
|
boolean |
onPreExecute()
Called before a console command is executed, and gives the listener a chance to intercept execution and run its own code.
|
boolean onPreExecute()
Called before a console command is executed, and gives the listener a chance to intercept execution and run its own code.
true
if your listener will take over execution of the command from its normal implementation, false
otherwise. If true
, CommandListener.execute
will be called by the console if your listener was the highest priority listener to request execution takeover.BaseCommand.CommandResult execute()
Called when your CommandListener declares that it wants to take over execution of a command.
This is only called if your listener returned true
during
and was the highest priority listener to do so.CommandListener.onPreExecute
CommandListener.onPreExecute
,
BaseCommand.runCommand
void onPostExecute()
Called after a command is run, regardless of whether execution was intercepted by a CommandListener or not.