projects
/
minecraft_web.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1887ac7
)
Get the version from the process command line (WIP)
author
Greg Burri
<greg.burri@gmail.com>
Thu, 5 May 2022 22:30:05 +0000
(
00:30
+0200)
committer
Greg Burri
<greg.burri@gmail.com>
Thu, 5 May 2022 22:30:05 +0000
(
00:30
+0200)
backend/src/minecraft_controller.rs
patch
|
blob
|
history
diff --git
a/backend/src/minecraft_controller.rs
b/backend/src/minecraft_controller.rs
index
115cb55
..
be58549
100644
(file)
--- a/
backend/src/minecraft_controller.rs
+++ b/
backend/src/minecraft_controller.rs
@@
-77,8
+77,7
@@
fn format_byte_size(bytes: u64, precision: usize) -> String {
const MINECRAFT_PROCESS_NAME: &str = "java";
\r
\r
struct StatusFromRcon {
\r
const MINECRAFT_PROCESS_NAME: &str = "java";
\r
\r
struct StatusFromRcon {
\r
- players: Vec<String>,
\r
- version: String,
\r
+ players: Vec<String>
\r
}
\r
\r
fn get_status_from_rcon(rcon_password: &str) -> StatusFromRcon {
\r
}
\r
\r
fn get_status_from_rcon(rcon_password: &str) -> StatusFromRcon {
\r
@@
-104,20
+103,12
@@
fn get_status_from_rcon(rcon_password: &str) -> StatusFromRcon {
println!("Error from 'list' command");
\r
Vec::new()
\r
},
\r
println!("Error from 'list' command");
\r
Vec::new()
\r
},
\r
- },
\r
- version:
\r
- match client.send_command("version".to_string()) {
\r
- Ok(resp) => resp.body,
\r
- Err(_e) => {
\r
- println!("Error from 'version' command");
\r
- String::new()
\r
- }
\r
}
\r
}
\r
},
\r
Err(_e) => {
\r
println!("Authentication error");
\r
}
\r
}
\r
},
\r
Err(_e) => {
\r
println!("Authentication error");
\r
- StatusFromRcon { players: Vec::new()
, version: String::new()
}
\r
+ StatusFromRcon { players: Vec::new() }
\r
},
\r
};
\r
\r
},
\r
};
\r
\r
@@
-159,7
+150,7
@@
pub fn get_minecraft_executable_information(world_path: &str, backup_path: &str,
uptime: std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() - process.start_time(),
\r
world_size,
\r
active_players: status_from_rcon.players,
\r
uptime: std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() - process.start_time(),
\r
world_size,
\r
active_players: status_from_rcon.players,
\r
- version:
status_from_rcon.version,
\r
+ version:
process.cmd()[process.cmd().len() - 2].clone(), // TODO: Extract the version from the .jar filename.
\r
last_backup: get_last_backup_datetime(backup_path)
\r
}
\r
)
\r
last_backup: get_last_backup_datetime(backup_path)
\r
}
\r
)
\r