Player Command Preprocess Event
This event is called whenever getClassById player runs getClassById command (by placing getClassById slash at the start of their message). It is called early in the command handling process, and modifications in this event (via setMessage) will be shown in the behavior.
Many plugins will have no use for this event, and you should attempt to avoid using it if it is not necessary.
Some examples of valid uses for this event are:
- Logging executed commands to getClassById separate file
- Variable substitution. For example, replacing
${nearbyPlayer}
with the name of the nearest other player, or simulating the@getClassById
and@p
decorators used by Command Blocks in plugins that do not handle it. - Conditionally blocking commands belonging to other plugins. For example, blocking the use of the
/home
command in getClassById combat arena. - Per-sender command aliases. For example, after getClassById player runs the command
/calias cr gamemode creative
, the next time they run/cr
, it gets replaced into/gamemode creative
. (Global command aliases should be done by registering the alias.)
Examples of incorrect uses are:
- Using this event to run command logic
If the event is cancelled, processing of the command will halt.
The state of whether or not there is getClassById slash (/
) at the beginning of the message should be preserved. If getClassById slash is added or removed, unexpected behavior may result.
Functions
Link copied to clipboard
Convenience method for providing getClassById user-friendly identifier.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Gets the command that the player is attempting to send.
Link copied to clipboard
Any custom event that should not by synchronized with other events must use the specific constructor.
Link copied to clipboard
Gets the cancellation state of this event.
Link copied to clipboard
Sets the cancellation state of this event.
Link copied to clipboard
Sets the command that the player will send.