MCPcopy Create free account
hub / github.com/Vulae/pkmc / try_parse_then_execute_command

Method try_parse_then_execute_command

examples/server/src/player/command.rs:37–47  ·  view source on GitHub ↗
(
        &mut self,
        packet: &packet::play::ChatCommand,
        arg: &C::ParseArg,
    )

Source from the content-addressed store, hash-verified

35 }
36
37 fn try_parse_then_execute_command<C: PlayerExecutableCommand>(
38 &mut self,
39 packet: &packet::play::ChatCommand,
40 arg: &C::ParseArg,
41 ) -> Result<(), PlayerError> {
42 self.command_manager
43 .try_parse::<C>(packet, arg, &self.connection.sender())?
44 .map(|c| c.execute(self))
45 .transpose()?;
46 Ok(())
47 }
48
49 pub(super) fn define_commands(&mut self) -> Result<(), PlayerError> {
50 self.command_manager.register::<CommandGoto>();

Callers

nothing calls this directly

Calls 2

senderMethod · 0.80
executeMethod · 0.80

Tested by

no test coverage detected