Module: command_rewrite
Overview
This module allows defining regex
to rewrite
the command line issued
by a player.
Color Boxes
◉ How it works?
-
Intercept the
issued command string
packets. -
Apply the defined rewrite rules to
the command string
in top-down order.
NOTE: The command_rewrite
occurs at the very beginning of the command lifecycle.
You will not receive command suggestions
or command exceptions
at this stage.
The rewrite rules are applied directly to the raw command string.
◉ Command Lifecycle
-
Issuing – The command is sent as
a raw string
. At this stage, no command suggestions or exceptions are available. -
Parsing – The command string is parsed into
a command node
. At this point, command suggestions and exceptions can be provided. -
Execution – The
actions
associated with the command node areexecuted
, producing the intendedeffects
of the command.
◉ The different compared to command_alias
module and command_bundle
module.
-
The
command alias
module allows you to definenew command
, and redirects it intoan existing command
. -
The
command bundle
module allows you to definenew command
, and define the argument and body of the new command. -
The
command rewrite
module didn't define any new command. It just works innetwork packet
level, and modifies theissued command string
from the command source player.
◉ You can use this module to shorten the command string.
Like, rewrite the command string /home
into /home tp default
.
And provide a shortcut, for /home tp default
command.
Configurations
The following JSON content is provided for reference only. It must NOT be copied directly into the configuration directory, as it does not represent valid JSON syntax.
- File Name:
config.json
- File Content:
Click to see the default
content...
{
/* Defined `rewrite` entries. */
"rules": [
{
"regex": "home",
"replacement": "home tp default"
}
]
}