File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
crates/hyperion/src/ingress Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,27 @@ pub fn process_handshake(
6666 }
6767}
6868
69+ #[ derive( Resource ) ]
70+ pub struct ServerPingResponse {
71+ pub description : String ,
72+ pub max_players : u32 ,
73+ }
74+
75+ impl Default for ServerPingResponse {
76+ fn default ( ) -> Self {
77+ ServerPingResponse {
78+ description : String :: from (
79+ "Getting 10k Players to PvP at Once on a Minecraft Server to Break the Guinness \
80+ World Record",
81+ ) ,
82+ max_players : 12_000 ,
83+ }
84+ }
85+ }
86+
6987fn process_status_request (
7088 mut packets : EventReader < ' _ , ' _ , packet:: status:: QueryRequest > ,
89+ ping_response_data : Res < ServerPingResponse > ,
7190 compose : Res < ' _ , Compose > ,
7291) {
7392 for packet in packets. read ( ) {
@@ -89,10 +108,10 @@ fn process_status_request(
89108 } ,
90109 "players" : {
91110 "online" : online,
92- "max" : 12_000 ,
111+ "max" : ping_response_data . max_players ,
93112 "sample" : [ ] ,
94113 } ,
95- "description" : "Getting 10k Players to PvP at Once on a Minecraft Server to Break the Guinness World Record" ,
114+ "description" : ping_response_data . description ,
96115 // "favicon": favicon,
97116 } ) ;
98117
@@ -288,5 +307,6 @@ impl Plugin for IngressPlugin {
288307 ) ,
289308 ) ;
290309 app. add_observer ( remove_player_from_visibility) ;
310+ app. init_resource :: < ServerPingResponse > ( ) ;
291311 }
292312}
You can’t perform that action at this time.
0 commit comments