@@ -32,6 +32,8 @@ type statusCmd struct {
32
32
UseProxy bool `usage:"supports contacting Bungeecord when proxy_protocol enabled"`
33
33
ProxyVersion byte `usage:"version of PROXY protocol to use" default:"1"`
34
34
35
+ SkipReadinessCheck bool `usage:"returns success when pinging a server without player info, or with a max player count of 0"`
36
+
35
37
ShowPlayerCount bool `usage:"show just the online player count"`
36
38
}
37
39
@@ -90,7 +92,7 @@ func (c *statusCmd) Execute(_ context.Context, _ *flag.FlagSet, args ...interfac
90
92
// While server is starting up it will answer pings, but respond with empty JSON object.
91
93
// As such, we'll sanity check the max players value to see if a zero-value has been
92
94
// provided for info.
93
- if info .Players .Max == 0 {
95
+ if info .Players .Max == 0 && ! c . SkipReadinessCheck {
94
96
95
97
_ , _ = fmt .Fprintf (os .Stderr , "server not ready %s:%d" , c .Host , c .Port )
96
98
return errors .New ("server not ready" )
@@ -127,7 +129,7 @@ func (c *statusCmd) ExecuteServerListPing() subcommands.ExitStatus {
127
129
return err
128
130
}
129
131
130
- if response .MaxPlayers == "0" {
132
+ if response .MaxPlayers == "0" && ! c . SkipReadinessCheck {
131
133
return errors .New ("server not ready" )
132
134
}
133
135
@@ -176,7 +178,7 @@ func (c *statusCmd) ExecuteMcUtilPing(logger *zap.Logger) subcommands.ExitStatus
176
178
response := hs .Properties .Infos ()
177
179
logger .Debug ("mcutils ping returned" , zap .Any ("properties" , response ))
178
180
179
- if response .Players .Max == 0 {
181
+ if response .Players .Max == 0 && ! c . SkipReadinessCheck {
180
182
return errors .New ("server not ready" )
181
183
}
182
184
0 commit comments