@@ -3,11 +3,7 @@ use anyhow::Result;
3
3
use serde_json:: json;
4
4
use tokio:: { io:: AsyncWriteExt , net:: TcpStream } ;
5
5
6
- use crate :: {
7
- client_sessions:: Session ,
8
- config:: get_config,
9
- packets:: status:: { StatusData , StatusPacket } ,
10
- } ;
6
+ use crate :: { client_sessions:: Session , config:: get_config, packets:: status} ;
11
7
12
8
pub async fn send ( stream : & mut TcpStream , session : & mut Session ) -> Result < ( ) > {
13
9
let config = get_config ( ) . await ;
@@ -17,21 +13,23 @@ pub async fn send(stream: &mut TcpStream, session: &mut Session) -> Result<()> {
17
13
config. proto_ver
18
14
} ;
19
15
20
- let icon = match & config . image {
21
- Some ( img ) => img ,
22
- None => & "" . to_string ( )
23
- } ;
24
-
25
- let data = StatusData {
26
- version_name : config. server_ver . clone ( ) ,
27
- version_protocol : proto_ver ,
28
- players_max : config . players_max ,
29
- players_online : config . players_online ,
16
+ let data = status :: StatusData {
17
+ version : status :: Version {
18
+ name : config . server_ver . clone ( ) ,
19
+ protocol : proto_ver ,
20
+ } ,
21
+ players : status :: Players {
22
+ max : config. players_max ,
23
+ online : config . players_online ,
24
+ sample : vec ! [ ] ,
25
+ } ,
30
26
description : json ! ( { "text" : config. motd. clone( ) } ) ,
31
- favicon : icon . to_string ( ) ,
27
+ favicon : config . image . clone ( ) ,
32
28
enforces_secure_chat : false ,
33
29
} ;
34
30
35
- stream. write_all ( & StatusPacket :: build ( data) ?) . await ?;
31
+ stream
32
+ . write_all ( & status:: StatusPacket :: build ( data) ?)
33
+ . await ?;
36
34
Ok ( ( ) )
37
35
}
0 commit comments