Use 'rcon' to get the player list
[minecraft_web.git] / backend / src / main.rs
index 53fbe68..2129033 100644 (file)
@@ -28,15 +28,15 @@ struct MainTemplate {
 const VALUE_UNKNOWN: &str = "-";
 
 #[cached(size = 1, time = 10)]
-fn get_minecraft_executable_information_cached(world_path: String, backup_path: String) -> Option<minecraft_controller::MinecraftExe> {
-    minecraft_controller::get_minecraft_executable_information(&world_path, &backup_path)
+fn get_minecraft_executable_information_cached(world_path: String, backup_path: String, rcon_password: String) -> Option<minecraft_controller::MinecraftExe> {
+    minecraft_controller::get_minecraft_executable_information(&world_path, &backup_path, &rcon_password)
 }
 
 #[get("/")]
 async fn main_page(config_shared: web::Data<Mutex<Config>>) -> impl Responder {
     let config = config_shared.lock().unwrap();
 
-    match get_minecraft_executable_information_cached(config.world_path.clone(), config.backup_path.clone()) {
+    match get_minecraft_executable_information_cached(config.world_path.clone(), config.backup_path.clone(), config.rcon_password.clone()) {
         Some(info) =>
             MainTemplate {
                 text_status: String::from("Minecraft server is up and running :)"),
@@ -144,7 +144,7 @@ fn process_args(config: &Config) -> bool {
         print_usage();
         return true
     } else if args.iter().any(|arg| arg == "--status") {
-        println!("{:?}", minecraft_controller::get_minecraft_executable_information(&config.world_path, &config.backup_path));
+        println!("{:?}", minecraft_controller::get_minecraft_executable_information(&config.world_path, &config.backup_path, &config.rcon_password));
         return true
     }