mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-08 00:36:11 +00:00
say command + playerlist works now
This commit is contained in:
@@ -73,7 +73,7 @@ fn load_plugins(server_resource_folder: String) -> Vec<Plugin> {
|
||||
plugins
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[derive(PartialEq, Eq, Clone, Debug, Default)]
|
||||
pub struct ServerStatus {
|
||||
pub player_count: usize,
|
||||
pub player_list: Vec<(u8, String)>,
|
||||
@@ -551,6 +551,18 @@ impl Server {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn send_chat_message(&self, message: &str, target: Option<u8>) {
|
||||
let packet = Packet::Raw(RawPacket::from_str(&format!("C:Server: {message}")));
|
||||
if let Some(_id) = target {
|
||||
// TODO: Implement this!
|
||||
todo!("Sending server chat messages to specific player is not supported yet!");
|
||||
// info!("[CHAT] Server @ {id}: {message}");
|
||||
} else {
|
||||
info!("[CHAT] Server: {message}");
|
||||
self.broadcast(packet, None).await;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Skips all clients that are currently connecting or syncing resources!
|
||||
async fn broadcast(&self, packet: Packet, owner: Option<u8>) {
|
||||
for client in &self.clients {
|
||||
|
||||
Reference in New Issue
Block a user