mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-18 15:36:22 +00:00
Compare commits
8 Commits
java16
...
2021.21.0-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4149db7f11 | ||
|
|
666f538ad5 | ||
|
|
145403ea54 | ||
|
|
5392801ecd | ||
|
|
3dfd70d068 | ||
|
|
e5bc9b939f | ||
|
|
1b620d2d6d | ||
|
|
28d77853cb |
8
.github/ISSUE_TEMPLATE/bug.yml
vendored
8
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -24,17 +24,9 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Container definition
|
label: Container definition
|
||||||
description: Please provide the compose file or run command used to create the container
|
description: Please provide the compose file or run command used to create the container
|
||||||
value: |
|
|
||||||
```
|
|
||||||
Paste run command or compose file here
|
|
||||||
```
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: logs
|
id: logs
|
||||||
attributes:
|
attributes:
|
||||||
label: Container logs
|
label: Container logs
|
||||||
description: |
|
description: |
|
||||||
Please provide container logs from the start of the container, which will be the ones prefixed with `[init]`. It is even better if you can set the variable `DEBUG` to "true" and provide those debug container logs.
|
Please provide container logs from the start of the container, which will be the ones prefixed with `[init]`. It is even better if you can set the variable `DEBUG` to "true" and provide those debug container logs.
|
||||||
value: |
|
|
||||||
```
|
|
||||||
Paste logs here
|
|
||||||
```
|
|
||||||
7
.github/ISSUE_TEMPLATE/config.yml
vendored
7
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,7 +0,0 @@
|
|||||||
contact_links:
|
|
||||||
- name: Ask a question in discussions
|
|
||||||
url: https://github.com/itzg/docker-minecraft-server/discussions
|
|
||||||
about: Please ask questions here
|
|
||||||
- name: Ask a question on Discord
|
|
||||||
url: https://discord.gg/DXfKpjB
|
|
||||||
about: Please ask questions here
|
|
||||||
2
.github/workflows/build-multiarch.yml
vendored
2
.github/workflows/build-multiarch.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2.4.0
|
uses: actions/checkout@v2.3.5
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
|
|||||||
2
.github/workflows/generate-toc.yml
vendored
2
.github/workflows/generate-toc.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.4.0
|
- uses: actions/checkout@v2.3.5
|
||||||
- run: |
|
- run: |
|
||||||
curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
|
curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
|
||||||
chmod a+x gh-md-toc
|
chmod a+x gh-md-toc
|
||||||
|
|||||||
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.4.0
|
- uses: actions/checkout@v2.3.5
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.4.0
|
- uses: actions/checkout@v2.3.5
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prep
|
id: prep
|
||||||
|
|||||||
2
.github/workflows/pr.yml
vendored
2
.github/workflows/pr.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.4.0
|
- uses: actions/checkout@v2.3.5
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -93,5 +93,5 @@ The multiarch images are built and published by [a Github action](https://github
|
|||||||
The following git command can be used to provide the bulk of release notes content:
|
The following git command can be used to provide the bulk of release notes content:
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --pretty="* %s" 1.1.0..1.2.0
|
git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --pretty="- %s" 1.1.0..1.2.0
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM eclipse-temurin:16-jdk
|
FROM eclipse-temurin:17-jdk
|
||||||
|
|
||||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||||
|
|
||||||
@@ -75,6 +75,7 @@ ENV UID=1000 GID=1000 \
|
|||||||
MEMORY="1G" \
|
MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST \
|
TYPE=VANILLA VERSION=LATEST \
|
||||||
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
|
SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||||
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
|
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
|
||||||
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0
|
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ By default, the container will download the latest version of the "vanilla" [Min
|
|||||||
* [Running on RaspberryPi](#running-on-raspberrypi)
|
* [Running on RaspberryPi](#running-on-raspberrypi)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
|
|
||||||
<!-- Added by: runner, at: Tue Nov 16 02:46:53 UTC 2021 -->
|
<!-- Added by: runner, at: Fri Nov 5 02:00:06 UTC 2021 -->
|
||||||
|
|
||||||
<!--te-->
|
<!--te-->
|
||||||
|
|
||||||
@@ -567,6 +567,8 @@ docker run -d -v /path/on/host:/data ... \
|
|||||||
-e FABRIC_LOADER_VERSION=0.11.7
|
-e FABRIC_LOADER_VERSION=0.11.7
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In order to add mods, you have two options:
|
||||||
|
|
||||||
### Running a Limbo server
|
### Running a Limbo server
|
||||||
|
|
||||||
A [Limbo](https://github.com/LOOHP/Limbo) server can be run by setting `TYPE` to `LIMBO`.
|
A [Limbo](https://github.com/LOOHP/Limbo) server can be run by setting `TYPE` to `LIMBO`.
|
||||||
@@ -806,8 +808,6 @@ This will reset any manual configuration of the `server.properties` file, so if
|
|||||||
|
|
||||||
In the opposite case, you can skip the startup script's creation of `server.properties`, by setting `SKIP_SERVER_PROPERTIES` to "true".
|
In the opposite case, you can skip the startup script's creation of `server.properties`, by setting `SKIP_SERVER_PROPERTIES` to "true".
|
||||||
|
|
||||||
> NOTE: to clear a server property, set the variable to an empty string, such as `-e RESOURCE_PACK=""`. A variables that maps to a server property that is unset, is ignored and the existing `server.property` is left unchanged.
|
|
||||||
|
|
||||||
### Message of the Day
|
### Message of the Day
|
||||||
|
|
||||||
The message of the day, shown below each server entry in the client UI, can be changed with the `MOTD` environment variable, such as
|
The message of the day, shown below each server entry in the client UI, can be changed with the `MOTD` environment variable, such as
|
||||||
@@ -875,7 +875,6 @@ The server icon which has been set doesn't get overridden by default. It can be
|
|||||||
### Rcon
|
### Rcon
|
||||||
|
|
||||||
To use rcon use the `ENABLE_RCON` and `RCON_PASSWORD` variables.
|
To use rcon use the `ENABLE_RCON` and `RCON_PASSWORD` variables.
|
||||||
The default RCON password is _"minecraft",_ but it's **highly** recommended to override that.
|
|
||||||
By default rcon port will be `25575` but can easily be changed with the `RCON_PORT` variable.
|
By default rcon port will be `25575` but can easily be changed with the `RCON_PORT` variable.
|
||||||
|
|
||||||
docker run -d -e ENABLE_RCON=true -e RCON_PASSWORD=testing
|
docker run -d -e ENABLE_RCON=true -e RCON_PASSWORD=testing
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# shellcheck source=../scripts/start-utils
|
# shellcheck source=../start-utils
|
||||||
. "${SCRIPTS:-/}start-utils"
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if isTrue "${DISABLE_HEALTHCHECK}"; then
|
if isTrue "${DISABLE_HEALTHCHECK}"; then
|
||||||
echo "Healthcheck disabled"
|
echo "Healthcheck disabled"
|
||||||
@@ -10,6 +10,6 @@ elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -ax -o stat,comm | grep 'java' |
|
|||||||
echo "Java process suspended by Autopause function"
|
echo "Java process suspended by Autopause function"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
mc-monitor status --host localhost --port "${SERVER_PORT:-25565}"
|
mc-monitor status --host localhost --port $SERVER_PORT
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
current_uptime() {
|
current_uptime() {
|
||||||
awk '{print $1}' /proc/uptime | cut -d . -f 1
|
echo $(awk '{print $1}' /proc/uptime | cut -d . -f 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
java_running() {
|
java_running() {
|
||||||
@@ -17,15 +17,15 @@ rcon_client_exists() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mc_server_listening() {
|
mc_server_listening() {
|
||||||
mc-monitor status --host localhost --port "$SERVER_PORT" --timeout 10s >& /dev/null
|
mc-monitor status --host localhost --port $SERVER_PORT --timeout 10s >& /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
java_clients_connected() {
|
java_clients_connected() {
|
||||||
local connections
|
local connections
|
||||||
if java_running ; then
|
if java_running ; then
|
||||||
connections=$(mc-monitor status --host localhost --port "$SERVER_PORT" --show-player-count)
|
connections=$(mc-monitor status --host localhost --port $SERVER_PORT --show-player-count)
|
||||||
else
|
else
|
||||||
connections=0
|
connections=0
|
||||||
fi
|
fi
|
||||||
(( connections > 0 ))
|
(( $connections > 0 ))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<Console name="SysOut" target="SYSTEM_OUT">
|
<Console name="SysOut" target="SYSTEM_OUT">
|
||||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
|
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
|
||||||
</Console>
|
</Console>
|
||||||
<Queue name="TerminalConsole">
|
<Queue name="ServerGuiConsole">
|
||||||
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
|
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
|
||||||
</Queue>
|
</Queue>
|
||||||
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
</filters>
|
</filters>
|
||||||
<AppenderRef ref="SysOut"/>
|
<AppenderRef ref="SysOut"/>
|
||||||
<AppenderRef ref="File"/>
|
<AppenderRef ref="File"/>
|
||||||
<AppenderRef ref="TerminalConsole"/>
|
<AppenderRef ref="ServerGuiConsole"/>
|
||||||
</Root>
|
</Root>
|
||||||
</Loggers>
|
</Loggers>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
@@ -1,15 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# shellcheck source=start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
. "${SCRIPTS:-/}start-utils"
|
|
||||||
|
|
||||||
: "${SERVER_PORT:=25565}"
|
|
||||||
export SERVER_PORT
|
|
||||||
|
|
||||||
log "Autopause functionality enabled"
|
log "Autopause functionality enabled"
|
||||||
|
|
||||||
isDebugging && set -x
|
|
||||||
|
|
||||||
cp /autopause/knockd-config.cfg /tmp/knockd-config.cfg
|
cp /autopause/knockd-config.cfg /tmp/knockd-config.cfg
|
||||||
|
|
||||||
# update server port to listen to
|
# update server port to listen to
|
||||||
|
|||||||
@@ -41,16 +41,6 @@ if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if versionLessThan 1.6; then
|
|
||||||
if ! [[ -L /data/minecraft_server.jar && /data/minecraft_server.jar -ef "/data/$SERVER" ]]; then
|
|
||||||
rm -f /data/minecraft_server.jar
|
|
||||||
ln -s "/data/$SERVER" /data/minecraft_server.jar
|
|
||||||
fi
|
|
||||||
SERVER=minecraft_server.jar
|
|
||||||
elif [[ -L /data/minecraft_server.jar ]]; then
|
|
||||||
rm -f /data/minecraft_server.jar
|
|
||||||
fi
|
|
||||||
|
|
||||||
isDebugging && ls -l
|
isDebugging && ls -l
|
||||||
|
|
||||||
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# shellcheck source=start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
. "${SCRIPTS:-/}start-utils"
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
: "${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}"
|
: ${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}
|
||||||
: "${REPLACE_ENV_PATHS:=/data}"
|
: ${REPLACE_ENV_PATHS:=/data}
|
||||||
: "${REPLACE_ENV_SUFFIXES:=yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml}"
|
: ${REPLACE_ENV_SUFFIXES:=yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml}
|
||||||
: "${REPLACE_ENV_VARIABLE_PREFIX:=${ENV_VARIABLE_PREFIX:-CFG_}}"
|
: ${REPLACE_ENV_VARIABLE_PREFIX:=${ENV_VARIABLE_PREFIX:-CFG_}}
|
||||||
: "${REPLACE_ENV_VARIABLES_EXCLUDES:=}"
|
: ${REPLACE_ENV_VARIABLES_EXCLUDES:=}
|
||||||
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
|
: ${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}
|
||||||
: "${PATCH_DEFINITIONS:=}"
|
: ${PATCH_DEFINITIONS:=}
|
||||||
: "${DEBUG:=false}"
|
: ${DEBUG:=false}
|
||||||
|
|
||||||
if isTrue "${REPLACE_ENV_IN_PLACE}"; then
|
if isTrue "${REPLACE_ENV_IN_PLACE}"; then
|
||||||
log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix $REPLACE_ENV_VARIABLE_PREFIX ..."
|
log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix $REPLACE_ENV_VARIABLE_PREFIX ..."
|
||||||
@@ -21,15 +20,15 @@ if isTrue "${REPLACE_ENV_IN_PLACE}"; then
|
|||||||
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
||||||
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
||||||
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
||||||
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
--replace-env-prefix=${REPLACE_ENV_VARIABLE_PREFIX} \
|
||||||
"${REPLACE_ENV_PATHS[@]}"
|
"${REPLACE_ENV_PATHS[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${PATCH_DEFINITIONS} ]]; then
|
if [[ ${PATCH_DEFINITIONS} ]]; then
|
||||||
log "Applying patch definitions from ${PATCH_DEFINITIONS}"
|
log "Applying patch definitions from ${PATCH_DEFINITIONS}"
|
||||||
mc-image-helper --debug=${DEBUG} patch \
|
mc-image-helper --debug=${DEBUG} patch \
|
||||||
--patch-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
--patch-env-prefix=${REPLACE_ENV_VARIABLE_PREFIX} \
|
||||||
"${PATCH_DEFINITIONS}"
|
"${PATCH_DEFINITIONS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "${SCRIPTS:-/}start-finalExec" "$@"
|
exec ${SCRIPTS:-/}start-finalExec $@
|
||||||
|
|||||||
@@ -1,46 +1,40 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# shellcheck source=start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
. "${SCRIPTS:-/}start-utils"
|
|
||||||
|
|
||||||
: "${SERVER_PROPERTIES:=/data/server.properties}"
|
: ${SERVER_PROPERTIES:=/data/server.properties}
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
function setServerPropValue {
|
|
||||||
local prop=$1
|
|
||||||
local value=$2
|
|
||||||
# normalize booleans
|
|
||||||
case ${value^^} in
|
|
||||||
TRUE|FALSE)
|
|
||||||
value=${value,,} ;;
|
|
||||||
esac
|
|
||||||
if grep "${prop}" "$SERVER_PROPERTIES" > /dev/null; then
|
|
||||||
log "Setting ${prop} to '${value}' in ${SERVER_PROPERTIES}"
|
|
||||||
sed -i "/^${prop}\s*=/ c ${prop}=${value//\\/\\\\}" "$SERVER_PROPERTIES"
|
|
||||||
else
|
|
||||||
log "Adding ${prop} with '${value}' in ${SERVER_PROPERTIES}"
|
|
||||||
echo "${prop}=${value}" >> "$SERVER_PROPERTIES"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function setServerProp {
|
function setServerProp {
|
||||||
local prop=$1
|
local prop=$1
|
||||||
local varName=$2
|
local var=$2
|
||||||
|
if [ -n "$var" ]; then
|
||||||
if [ -v $varName ]; then
|
# normalize booleans
|
||||||
setServerPropValue "$prop" "${!varName}"
|
case ${var^^} in
|
||||||
|
TRUE|FALSE)
|
||||||
|
var=${var,,} ;;
|
||||||
|
esac
|
||||||
|
if grep "${prop}" "$SERVER_PROPERTIES" > /dev/null; then
|
||||||
|
log "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}"
|
||||||
|
sed -i "/^${prop}\s*=/ c ${prop}=${var//\\/\\\\}" "$SERVER_PROPERTIES"
|
||||||
|
else
|
||||||
|
log "Adding ${prop} with '${var}' in ${SERVER_PROPERTIES}"
|
||||||
|
echo "${prop}=${var}" >> "$SERVER_PROPERTIES"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
isDebugging && log "Skip setting ${prop}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function customizeServerProps {
|
function customizeServerProps {
|
||||||
if [ -n "$WHITELIST" ] || isTrue "${ENABLE_WHITELIST:-false}"; then
|
if [ -n "$WHITELIST" ] || isTrue ${ENABLE_WHITELIST:-false}; then
|
||||||
log "Creating whitelist"
|
log "Creating whitelist"
|
||||||
setServerPropValue "whitelist" "true"
|
setServerProp "whitelist" "true"
|
||||||
setServerPropValue "white-list" "true"
|
setServerProp "white-list" "true"
|
||||||
else
|
else
|
||||||
log "Disabling whitelist"
|
log "Disabling whitelist"
|
||||||
setServerPropValue "whitelist" "false"
|
setServerProp "whitelist" "false"
|
||||||
setServerPropValue "white-list" "false"
|
setServerProp "white-list" "false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If not provided, generate a reasonable default message-of-the-day,
|
# If not provided, generate a reasonable default message-of-the-day,
|
||||||
@@ -59,57 +53,57 @@ function customizeServerProps {
|
|||||||
MOTD="A ${label} Minecraft Server powered by Docker"
|
MOTD="A ${label} Minecraft Server powered by Docker"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setServerProp "server-name" SERVER_NAME
|
setServerProp "server-name" "$SERVER_NAME"
|
||||||
setServerProp "server-ip" SERVER_IP
|
setServerProp "server-ip" "$SERVER_IP"
|
||||||
setServerProp "server-port" SERVER_PORT
|
setServerProp "server-port" "$SERVER_PORT"
|
||||||
setServerProp "allow-nether" ALLOW_NETHER
|
setServerProp "motd" "$(echo $MOTD | mc-image-helper asciify)"
|
||||||
setServerProp "announce-player-achievements" ANNOUNCE_PLAYER_ACHIEVEMENTS
|
setServerProp "allow-nether" "$ALLOW_NETHER"
|
||||||
setServerProp "enable-command-block" ENABLE_COMMAND_BLOCK
|
setServerProp "announce-player-achievements" "$ANNOUNCE_PLAYER_ACHIEVEMENTS"
|
||||||
setServerProp "spawn-animals" SPAWN_ANIMALS
|
setServerProp "enable-command-block" "$ENABLE_COMMAND_BLOCK"
|
||||||
setServerProp "spawn-monsters" SPAWN_MONSTERS
|
setServerProp "spawn-animals" "$SPAWN_ANIMALS"
|
||||||
setServerProp "spawn-npcs" SPAWN_NPCS
|
setServerProp "spawn-monsters" "$SPAWN_MONSTERS"
|
||||||
setServerProp "spawn-protection" SPAWN_PROTECTION
|
setServerProp "spawn-npcs" "$SPAWN_NPCS"
|
||||||
setServerProp "generate-structures" GENERATE_STRUCTURES
|
setServerProp "spawn-protection" "$SPAWN_PROTECTION"
|
||||||
setServerProp "view-distance" VIEW_DISTANCE
|
setServerProp "generate-structures" "$GENERATE_STRUCTURES"
|
||||||
setServerProp "hardcore" HARDCORE
|
setServerProp "view-distance" "$VIEW_DISTANCE"
|
||||||
setServerProp "snooper-enabled" SNOOPER_ENABLED
|
setServerProp "hardcore" "$HARDCORE"
|
||||||
setServerProp "max-build-height" MAX_BUILD_HEIGHT
|
setServerProp "snooper-enabled" "$SNOOPER_ENABLED"
|
||||||
setServerProp "force-gamemode" FORCE_GAMEMODE
|
setServerProp "max-build-height" "$MAX_BUILD_HEIGHT"
|
||||||
setServerProp "max-tick-time" MAX_TICK_TIME
|
setServerProp "force-gamemode" "$FORCE_GAMEMODE"
|
||||||
setServerProp "enable-query" ENABLE_QUERY
|
setServerProp "max-tick-time" "$MAX_TICK_TIME"
|
||||||
setServerProp "query.port" QUERY_PORT
|
setServerProp "enable-query" "$ENABLE_QUERY"
|
||||||
setServerProp "enable-rcon" ENABLE_RCON
|
setServerProp "query.port" "$QUERY_PORT"
|
||||||
setServerProp "rcon.password" RCON_PASSWORD
|
setServerProp "enable-rcon" "$ENABLE_RCON"
|
||||||
setServerProp "rcon.port" RCON_PORT
|
setServerProp "rcon.password" "$RCON_PASSWORD"
|
||||||
setServerProp "max-players" MAX_PLAYERS
|
setServerProp "rcon.port" "$RCON_PORT"
|
||||||
setServerProp "max-world-size" MAX_WORLD_SIZE
|
setServerProp "max-players" "$MAX_PLAYERS"
|
||||||
setServerProp "level-name" LEVEL
|
setServerProp "max-world-size" "$MAX_WORLD_SIZE"
|
||||||
setServerProp "level-seed" SEED
|
setServerProp "level-name" "$LEVEL"
|
||||||
setServerProp "pvp" PVP
|
setServerProp "level-seed" "$SEED"
|
||||||
setServerProp "generator-settings" GENERATOR_SETTINGS
|
setServerProp "pvp" "${PVP}"
|
||||||
setServerProp "online-mode" ONLINE_MODE
|
setServerProp "generator-settings" "$GENERATOR_SETTINGS"
|
||||||
setServerProp "allow-flight" ALLOW_FLIGHT
|
setServerProp "online-mode" "$ONLINE_MODE"
|
||||||
setServerProp "resource-pack" RESOURCE_PACK
|
setServerProp "allow-flight" "$ALLOW_FLIGHT"
|
||||||
setServerProp "resource-pack-sha1" RESOURCE_PACK_SHA1
|
setServerProp "level-type" "${LEVEL_TYPE^^}"
|
||||||
setServerProp "player-idle-timeout" PLAYER_IDLE_TIMEOUT
|
setServerProp "resource-pack" "$RESOURCE_PACK"
|
||||||
setServerProp "broadcast-console-to-ops" BROADCAST_CONSOLE_TO_OPS
|
setServerProp "resource-pack-sha1" "$RESOURCE_PACK_SHA1"
|
||||||
setServerProp "broadcast-rcon-to-ops" BROADCAST_RCON_TO_OPS
|
setServerProp "player-idle-timeout" "$PLAYER_IDLE_TIMEOUT"
|
||||||
setServerProp "enable-jmx-monitoring" ENABLE_JMX
|
setServerProp "broadcast-console-to-ops" "$BROADCAST_CONSOLE_TO_OPS"
|
||||||
setServerProp "sync-chunk-writes" SYNC_CHUNK_WRITES
|
setServerProp "broadcast-rcon-to-ops" "$BROADCAST_RCON_TO_OPS"
|
||||||
setServerProp "enable-status" ENABLE_STATUS
|
setServerProp "enable-jmx-monitoring" "$ENABLE_JMX"
|
||||||
setServerProp "entity-broadcast-range-percentage" ENTITY_BROADCAST_RANGE_PERCENTAGE
|
setServerProp "sync-chunk-writes" "$SYNC_CHUNK_WRITES"
|
||||||
setServerProp "function-permission-level" FUNCTION_PERMISSION_LEVEL
|
setServerProp "enable-status" "$ENABLE_STATUS"
|
||||||
setServerProp "network-compression-threshold" NETWORK_COMPRESSION_THRESHOLD
|
setServerProp "entity-broadcast-range-percentage" "$ENTITY_BROADCAST_RANGE_PERCENTAGE"
|
||||||
setServerProp "op-permission-level" OP_PERMISSION_LEVEL
|
setServerProp "function-permission-level" "$FUNCTION_PERMISSION_LEVEL"
|
||||||
setServerProp "prevent-proxy-connections" PREVENT_PROXY_CONNECTIONS
|
setServerProp "network-compression-threshold" "$NETWORK_COMPRESSION_THRESHOLD"
|
||||||
setServerProp "use-native-transport" USE_NATIVE_TRANSPORT
|
setServerProp "op-permission-level" "$OP_PERMISSION_LEVEL"
|
||||||
setServerProp "enforce-whitelist" ENFORCE_WHITELIST
|
setServerProp "prevent-proxy-connections" "$PREVENT_PROXY_CONNECTIONS"
|
||||||
setServerProp "simulation-distance" SIMULATION_DISTANCE
|
setServerProp "use-native-transport" "$USE_NATIVE_TRANSPORT"
|
||||||
setServerPropValue "motd" "$(echo "$MOTD" | mc-image-helper asciify)"
|
setServerProp "enforce-whitelist" "$ENFORCE_WHITELIST"
|
||||||
[[ $LEVEL_TYPE ]] && setServerPropValue "level-type" "${LEVEL_TYPE^^}"
|
setServerProp "simulation-distance" "$SIMULATION_DISTANCE"
|
||||||
|
|
||||||
if [ -n "$DIFFICULTY" ]; then
|
if [ -n "$DIFFICULTY" ]; then
|
||||||
case ${DIFFICULTY,,} in
|
case $DIFFICULTY in
|
||||||
peaceful|0)
|
peaceful|0)
|
||||||
if versionLessThan 1.13; then
|
if versionLessThan 1.13; then
|
||||||
DIFFICULTY=0
|
DIFFICULTY=0
|
||||||
@@ -143,12 +137,13 @@ function customizeServerProps {
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
setServerPropValue "difficulty" "$DIFFICULTY"
|
setServerProp "difficulty" "$DIFFICULTY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$MODE" ]; then
|
if [ -n "$MODE" ]; then
|
||||||
log "Setting mode"
|
log "Setting mode"
|
||||||
case ${MODE,,} in
|
MODE_LC=$( echo $MODE | tr '[:upper:]' '[:lower:]' )
|
||||||
|
case $MODE_LC in
|
||||||
su*|0)
|
su*|0)
|
||||||
if versionLessThan 1.13; then
|
if versionLessThan 1.13; then
|
||||||
MODE=0
|
MODE=0
|
||||||
@@ -182,7 +177,7 @@ function customizeServerProps {
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
setServerPropValue "gamemode" "$MODE"
|
setServerProp "gamemode" "$MODE"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,16 +210,16 @@ fi
|
|||||||
|
|
||||||
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
||||||
current_max_tick=$( grep 'max-tick-time' "$SERVER_PROPERTIES" | sed -r 's/( )+//g' | awk -F= '{print $2}' )
|
current_max_tick=$( grep 'max-tick-time' "$SERVER_PROPERTIES" | sed -r 's/( )+//g' | awk -F= '{print $2}' )
|
||||||
if (( current_max_tick > 0 && current_max_tick < 86400000 )); then
|
if (( $current_max_tick > 0 && $current_max_tick < 86400000 )); then
|
||||||
log "Warning: The server.properties for the server doesn't have the Server Watchdog (effectively) disabled."
|
log "Warning: The server.properties for the server doesn't have the Server Watchdog (effectively) disabled."
|
||||||
log "Warning (cont): Autopause functionality resuming the process might trigger the Watchdog and restart the server completely."
|
log "Warning (cont): Autopause functionality resuming the process might trigger the Watchdog and restart the server completely."
|
||||||
log "Warning (cont): Set the max-tick-time property to a high value (or disable the Watchdog with value -1 for versions 1.8.1+)."
|
log "Warning (cont): Set the max-tick-time property to a high value (or disable the Watchdog with value -1 for versions 1.8.1+)."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if isDebugging && [ -f "${SERVER_PROPERTIES}" ]; then
|
if isDebugging; then
|
||||||
log "DEBUG Dumping server.properties"
|
log "DEBUG Dumping server.properties"
|
||||||
cat "${SERVER_PROPERTIES}"
|
cat "${SERVER_PROPERTIES}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "${SCRIPTS:-/}start-setupEnvVariables" "$@"
|
exec ${SCRIPTS:-/}start-setupEnvVariables $@
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# shellcheck source=start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
. "${SCRIPTS:-/}start-utils"
|
|
||||||
set -e
|
set -e
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
|
: ${LEVEL:=world}
|
||||||
|
export LEVEL
|
||||||
|
|
||||||
if [ $TYPE = "CURSEFORGE" ]; then
|
if [ $TYPE = "CURSEFORGE" ]; then
|
||||||
worldDest=$FTB_DIR/${LEVEL:-world}
|
worldDest=$FTB_DIR/$LEVEL
|
||||||
else
|
else
|
||||||
worldDest=/data/${LEVEL:-world}
|
worldDest=/data/$LEVEL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] ); then
|
if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] ); then
|
||||||
@@ -69,4 +71,4 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "${SCRIPTS:-/}start-setupModpack" "$@"
|
exec ${SCRIPTS:-/}start-setupModpack $@
|
||||||
|
|||||||
Reference in New Issue
Block a user