1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include "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;
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("%s: invalid", server->name);
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;
}
|