pub struct PlayerInput { msg_router: tokio::sync::mpsc::Sender, } pub(super) fn handler(init_ctx: &crate::InitConfig) -> crate::handlers::SimpleRlnl { crate::handlers::SimpleRlnl::new(PlayerInput::new(init_ctx)) } impl PlayerInput { fn new(init_ctx: &crate::InitConfig) -> Self { Self { msg_router: init_ctx.matches_chann.clone(), } } } #[async_trait::async_trait] impl crate::handlers::RlnlEventCodeHandler for PlayerInput { type In = rlnl::events::ingame::PlayerIdAndInputData; const CODE: rlnl::event_code::NetworkEvent = rlnl::event_code::NetworkEvent::OnPlayerInputChanged; async fn handle(&self, data: Self::In, _peer: &std::sync::Arc>, user: &crate::UserData, _sender: &std::sync::Arc>) { if let Some(user_info) = user.user().await { super::log_channel_send_failure(self.msg_router.send(crate::matches::GameMessage::PlayerInputChanged { user_id: user_info.account_id(), data, }).await); } else { log::error!("Failed to rebroadcast OnPlayerInputChanged for user (no auth!)"); } } }