diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-27 15:18:45 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-27 15:18:45 +0200 |
commit | 99b2c70137fef05a5a18f439b9010ddba455f5cb (patch) | |
tree | b0c08cfce14019cd634e6b4b84d0cf0f6e8eee6a /minecctl/rcon-commands.c | |
parent | a87e894ba3f3a8915389f651fb034f0d1835630c (diff) |
Create a shared mc protocol implementation and use it in the proxy and cmd line tool
Diffstat (limited to 'minecctl/rcon-commands.c')
-rw-r--r-- | minecctl/rcon-commands.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/minecctl/rcon-commands.c b/minecctl/rcon-commands.c index 02b970f..cf43c5e 100644 --- a/minecctl/rcon-commands.c +++ b/minecctl/rcon-commands.c @@ -387,23 +387,22 @@ do_stop_all(struct cfg *cfg) { } bool -do_pcount(struct cfg *cfg) { - int fd; - unsigned current, max; +do_rcon_pcount(struct cfg *cfg, unsigned *online, unsigned *max) +{ struct server *server; + bool rv; + int fd; server = server_get_default(cfg); fd = rcon_login(cfg, server); if (fd < 0) return false; - if (get_player_count(fd, ¤t, &max)) { - info("Players: %u/%u", current, max); - return true; - } else { - die("Failed to get player count"); - return false; - } + rv = get_player_count(fd, online, max); + + close(fd); + + return rv; } bool |