mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-08-31 11:17:14 +00:00
1863: use SLP for pre-1.7 servers. (#3336)
This commit is contained in:
@@ -24,14 +24,20 @@ use_proxy() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use_server_list_ping() {
|
||||||
|
if versionLessThan 1.7; then
|
||||||
|
echo "--use-server-list-ping"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
mc_server_listening() {
|
mc_server_listening() {
|
||||||
mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --timeout 10s >&/dev/null
|
mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" $(use_server_list_ping) --timeout 10s >&/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
java_clients_connections() {
|
java_clients_connections() {
|
||||||
local connections
|
local connections
|
||||||
if java_running; then
|
if java_running; then
|
||||||
if ! connections=$(mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --show-player-count); then
|
if ! connections=$(mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" $(use_server_list_ping) --show-player-count); then
|
||||||
# consider it a non-zero player count if the ping fails
|
# consider it a non-zero player count if the ping fails
|
||||||
# otherwise a laggy server with players connected could get paused
|
# otherwise a laggy server with players connected could get paused
|
||||||
connections=1
|
connections=1
|
||||||
|
|||||||
Reference in New Issue
Block a user