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
- theServer
instance executing the command.EcsEntity
- anEntity
corresponding to the player that invoked the command.EcsEntity
- anEntity
for the player on whom the command is invoked. This differs from the previous argument when using /sudoVec<String>
- aVec<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 givenString
(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.