Type Alias veloren_server::cmd::CommandHandler

source ·
type CommandHandler = fn(_: &mut Server, _: Entity, _: Entity, _: Vec<String>, _: &ServerChatCommand) -> Result<(), Content>;
Expand description

Handler function called when the command is executed.

§Arguments

  • &mut Server - the Server instance executing the command.
  • EcsEntity - an Entity corresponding to the player that invoked the command.
  • EcsEntity - an Entity for the player on whom the command is invoked. This differs from the previous argument when using /sudo
  • Vec<String> - a Vec<String> containing the arguments of the command after the keyword.
  • &ChatCommand - the command to execute with the above arguments – Handler functions must parse arguments from the the given String (parse_args! exists for this purpose).

§Returns

A Result that is Ok if the command went smoothly, and Err if it failed; on failure, the string is sent to the client who initiated the command.