projects
/
minecraft_web.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix how the output of the list command is handled
[minecraft_web.git]
/
backend
/
src
/
minecraft_controller.rs
diff --git
a/backend/src/minecraft_controller.rs
b/backend/src/minecraft_controller.rs
index
163008a
..
a644c4d
100644
(file)
--- a/
backend/src/minecraft_controller.rs
+++ b/
backend/src/minecraft_controller.rs
@@
-86,14
+86,11
@@
fn get_status_from_rcon(rcon_password: &str) -> StatusFromRcon {
StatusFromRcon {
\r
players:
\r
match client.send_command("list".to_string()) {
\r
StatusFromRcon {
\r
players:
\r
match client.send_command("list".to_string()) {
\r
- Ok(resp) => {
\r
- resp.body
\r
- .split('\n')
\r
- .skip(1)
\r
- .filter(|n| !n.is_empty())
\r
- .map(|n| n.to_string())
\r
- .collect()
\r
- },
\r
+ Ok(resp) =>
\r
+ match resp.body.find(':') {
\r
+ Some(i) => resp.body[i + 1..resp.body.len() - 1].split(',').map(|nick| nick.trim().to_string()).collect(),
\r
+ None => Vec::new()
\r
+ },
\r
Err(_e) => {
\r
println!("Error from 'list' command");
\r
Vec::new()
\r
Err(_e) => {
\r
println!("Error from 'list' command");
\r
Vec::new()
\r