#include "shared/utils.h" #include "minecctl.h" #include "server.h" #include "misc-commands.h" #include "rcon-commands.h" #include "mc-commands.h" bool do_list(struct cfg *cfg) { struct server *server; /* server->scfg.filename check excludes servers created from cmdline */ list_for_each_entry(server, &cfg->servers, list) if (server->scfg.filename) info("%s", server->name); return true; } bool do_lint(struct cfg *cfg) { struct server *server; const char *error; bool rv = true; /* server->scfg.filename check excludes servers created from cmdline */ list_for_each_entry(server, &cfg->servers, list) { if (!server->scfg.filename) continue; info("• %s", server->name); /* FIXME: should return bool */ server_read_config(cfg, server); if (!scfg_validate(&server->scfg, &error)) { error("%s: invalid (%s)", server->name, error); rv = false; } } return rv; } bool do_pcount(struct cfg *cfg) { unsigned x, y; if (do_rcon_pcount(cfg, &y, &x)) error("Rcon says %u/%u", y, x); if (do_mc_pcount(cfg, &y, &x)) error("MC says %u/%u", y, x); return true; }