fixed the event handler registration stuff

This commit is contained in:
Luuk van Oijen
2023-11-13 16:57:45 +01:00
parent a0db8aa8be
commit e781bbac8e
4 changed files with 63 additions and 35 deletions

View File

@@ -363,6 +363,13 @@ impl Server {
match event {
ServerBoundPluginEvent::PluginLoaded => plugin.send_event(PluginBoundPluginEvent::CallEventHandler((ScriptEvent::OnPluginLoaded, Vec::new()))).await,
ServerBoundPluginEvent::RequestPlayerCount(responder) => { let _ = responder.send(PluginBoundPluginEvent::PlayerCount(self.clients.len())); }
ServerBoundPluginEvent::RequestPlayers(responder) => {
let mut players = HashMap::new();
for client in &self.clients {
players.insert(client.id, client.get_name().to_string());
}
let _ = responder.send(PluginBoundPluginEvent::Players(players));
}
_ => {},
}
}