Skip to content

Commit fcfb1cd

Browse files
authored
1863: use SLP for pre-1.7 servers. (#3336)
1 parent beb3b4a commit fcfb1cd

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

files/auto/autopause-fcns.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ use_proxy() {
2424
fi
2525
}
2626

27+
use_server_list_ping() {
28+
if versionLessThan 1.7; then
29+
echo "--use-server-list-ping"
30+
fi
31+
}
32+
2733
mc_server_listening() {
28-
mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --timeout 10s >&/dev/null
34+
mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" $(use_server_list_ping) --timeout 10s >&/dev/null
2935
}
3036

3137
java_clients_connections() {
3238
local connections
3339
if java_running; then
34-
if ! connections=$(mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --show-player-count); then
40+
if ! connections=$(mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" $(use_server_list_ping) --show-player-count); then
3541
# consider it a non-zero player count if the ping fails
3642
# otherwise a laggy server with players connected could get paused
3743
connections=1
@@ -44,4 +50,4 @@ java_clients_connections() {
4450

4551
java_clients_connected() {
4652
(( $(java_clients_connections) > 0 ))
47-
}
53+
}

0 commit comments

Comments
 (0)