mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 15:13:55 +00:00
Compare commits
93 Commits
2021.27.0-
...
2021.25.0-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
958aedf731 | ||
|
|
0e1c9261d1 | ||
|
|
acc7c0568a | ||
|
|
3b0f82fedd | ||
|
|
ac234ae658 | ||
|
|
0f9d81e5f1 | ||
|
|
7072f5dc91 | ||
|
|
9b155f2496 | ||
|
|
add00ad38d | ||
|
|
a3cff3ce88 | ||
|
|
601d587927 | ||
|
|
e195a38faa | ||
|
|
e704348630 | ||
|
|
893f6754f0 | ||
|
|
f137251e22 | ||
|
|
869f167c0c | ||
|
|
3d7107bdbd | ||
|
|
bce01eb1a2 | ||
|
|
c5d1b655ce | ||
|
|
529e9fd058 | ||
|
|
905768d050 | ||
|
|
0dd0199d5c | ||
|
|
925a63f035 | ||
|
|
f4be04ceb4 | ||
|
|
db4594b3b3 | ||
|
|
bfd4e6247c | ||
|
|
4e31acb896 | ||
|
|
78e4ecc1d7 | ||
|
|
a2251f23e1 | ||
|
|
6ef0da9a63 | ||
|
|
4321d2a7e6 | ||
|
|
639e0264c2 | ||
|
|
1c4db94b1b | ||
|
|
f0cebe526a | ||
|
|
20b1477672 | ||
|
|
c4b4997fac | ||
|
|
d442f164ba | ||
|
|
34d4385ea6 | ||
|
|
cc84e65979 | ||
|
|
6f5fcc42f9 | ||
|
|
071621b54a | ||
|
|
230a64af1b | ||
|
|
1f980edeb1 | ||
|
|
649263290f | ||
|
|
990de92dd7 | ||
|
|
4f15c244b2 | ||
|
|
5f9c8f53e4 | ||
|
|
57fee8b46d | ||
|
|
79face2d60 | ||
|
|
ceec69391c | ||
|
|
dfa5add6ba | ||
|
|
02677ce1e2 | ||
|
|
2902e13c61 | ||
|
|
6d01021a30 | ||
|
|
07ded28d20 | ||
|
|
a2d79fb85b | ||
|
|
ecf9a090b1 | ||
|
|
17a3aa8079 | ||
|
|
14fb905ec1 | ||
|
|
8629bf5cb5 | ||
|
|
f05891e475 | ||
|
|
f1453dd4c1 | ||
|
|
22b560ba5d | ||
|
|
e3acafee2f | ||
|
|
03df627881 | ||
|
|
d87e5bdaa2 | ||
|
|
2543a5417c | ||
|
|
614f6a4be0 | ||
|
|
fe9735d8c1 | ||
|
|
10dcbe7b03 | ||
|
|
85103cd8cf | ||
|
|
12915b04b7 | ||
|
|
fbc8f72a22 | ||
|
|
7229c40202 | ||
|
|
581b514970 | ||
|
|
d030daf354 | ||
|
|
98e6adbe1a | ||
|
|
b94cfc44a0 | ||
|
|
8a9e85fb17 | ||
|
|
8a39719427 | ||
|
|
4100aa1f61 | ||
|
|
4d5fe0a03b | ||
|
|
236bb565ce | ||
|
|
7608168823 | ||
|
|
acabb9d93c | ||
|
|
4e9c00c4d5 | ||
|
|
f3826422cf | ||
|
|
9b7459ad5c | ||
|
|
c9dc6012f6 | ||
|
|
a5aec72837 | ||
|
|
af38a8fc7a | ||
|
|
58fa3c897d | ||
|
|
e45621d8e2 |
4
.github/release.yml
vendored
4
.github/release.yml
vendored
@@ -1,4 +0,0 @@
|
||||
changelog:
|
||||
exclude:
|
||||
authors:
|
||||
- dependabot
|
||||
2
.github/workflows/build-multiarch.yml
vendored
2
.github/workflows/build-multiarch.yml
vendored
@@ -81,7 +81,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2.7.0
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
platforms: linux/amd64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
# ensure latest base image is used
|
||||
|
||||
2
.github/workflows/stale-check.yml
vendored
2
.github/workflows/stale-check.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Process Stale Issues
|
||||
uses: actions/stale@v4.1.0
|
||||
uses: actions/stale@v4.0.0
|
||||
with:
|
||||
stale-issue-label: status/stale
|
||||
stale-pr-label: status/stale
|
||||
|
||||
10
Dockerfile
10
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM eclipse-temurin:17-jdk
|
||||
FROM adoptopenjdk:16-jdk-openj9
|
||||
|
||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||
|
||||
@@ -60,7 +60,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
ARG MC_HELPER_VERSION=1.11.0
|
||||
ARG MC_HELPER_VERSION=1.10.0
|
||||
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/v${MC_HELPER_VERSION}
|
||||
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
|
||||
| tar -C /usr/share -zxf - \
|
||||
@@ -76,8 +76,7 @@ ENV UID=1000 GID=1000 \
|
||||
TYPE=VANILLA VERSION=LATEST \
|
||||
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
|
||||
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0 \
|
||||
ENABLE_AUTOSTOP=false AUTOSTOP_TIMEOUT_EST=3600 AUTOSTOP_TIMEOUT_INIT=1800 AUTOSTOP_PERIOD=10
|
||||
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0
|
||||
|
||||
COPY --chmod=755 scripts/start* /
|
||||
COPY --chmod=755 bin/ /usr/local/bin/
|
||||
@@ -85,9 +84,8 @@ COPY --chmod=755 bin/mc-health /health.sh
|
||||
COPY --chmod=644 files/server.properties /tmp/server.properties
|
||||
COPY --chmod=644 files/log4j2.xml /tmp/log4j2.xml
|
||||
COPY --chmod=755 files/autopause /autopause
|
||||
COPY --chmod=755 files/autostop /autostop
|
||||
|
||||
RUN dos2unix /start* /autopause/* /autostop/*
|
||||
RUN dos2unix /start* /autopause/*
|
||||
|
||||
ENTRYPOINT [ "/start" ]
|
||||
HEALTHCHECK --start-period=1m CMD mc-health
|
||||
|
||||
48
README.md
48
README.md
@@ -73,7 +73,6 @@ By default, the container will download the latest version of the "vanilla" [Min
|
||||
* [Downloadable world](#downloadable-world)
|
||||
* [Cloning world from a container path](#cloning-world-from-a-container-path)
|
||||
* [Overwrite world on start](#overwrite-world-on-start)
|
||||
* [Datapacks](#datapacks)
|
||||
* [Server configuration](#server-configuration)
|
||||
* [Message of the Day](#message-of-the-day)
|
||||
* [Difficulty](#difficulty)
|
||||
@@ -132,11 +131,10 @@ By default, the container will download the latest version of the "vanilla" [Min
|
||||
* [Autopause](#autopause)
|
||||
* [Description](#description)
|
||||
* [Enabling Autopause](#enabling-autopause)
|
||||
* [Autostop](#autostop)
|
||||
* [Running on RaspberryPi](#running-on-raspberrypi)
|
||||
* [Contributing](#contributing)
|
||||
|
||||
<!-- Added by: runner, at: Wed Dec 22 13:01:43 UTC 2021 -->
|
||||
<!-- Added by: runner, at: Sat Dec 11 22:09:10 UTC 2021 -->
|
||||
|
||||
<!--te-->
|
||||
|
||||
@@ -454,13 +452,19 @@ Plugins can either be managed within the `plugins` subdirectory of the [data dir
|
||||
|
||||
Enable Paper server mode by adding a `-e TYPE=PAPER` to your command-line.
|
||||
|
||||
By default, the container will run the latest build of [Paper server](https://papermc.io/downloads) but you can also choose to run a specific build with `-e PAPERBUILD=205`.
|
||||
By default the container will run the latest build of [Paper server](https://papermc.io/downloads)
|
||||
but you can also choose to run a specific build with `-e PAPERBUILD=205`.
|
||||
|
||||
docker run -d -v /path/on/host:/data \
|
||||
-e TYPE=PAPER \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
|
||||
If you are hosting your own copy of Paper you can override the download URL with `PAPER_DOWNLOAD_URL=<url>`.
|
||||
If you are hosting your own copy of Paper you can override the download URL with:
|
||||
|
||||
- -e PAPER_DOWNLOAD_URL=<url>
|
||||
|
||||
An example compose file is provided at
|
||||
[examples/docker-compose-paper.yml](examples/docker-compose-paper.yml).
|
||||
|
||||
If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](#optional-plugins-mods-and-config-attach-points). If you add plugins while the container is running, you'll need to restart it to pick those up.
|
||||
|
||||
@@ -472,7 +476,7 @@ An [Airplane](https://airplane.gg) server, which is "a stable, optimized, well s
|
||||
|
||||
-e TYPE=AIRPLANE
|
||||
|
||||
> NOTE: The `VERSION` variable is used to select an Airplane branch to download from. The available options are "LATEST" "1.17" and "PURPUR"
|
||||
> NOTE: The `VERSION` variable is used to select an Airplane branch to download from. The available options are "LATEST" "1.17" "1.16" "PURPUR" and "PURPUR-1.16"
|
||||
|
||||
Extra variables:
|
||||
- `AIRPLANE_BUILD=lastSuccessfulBuild` : set a specific Airplane build to use
|
||||
@@ -794,16 +798,6 @@ The following diagram shows how this option can be used in a compose deployment
|
||||
### Overwrite world on start
|
||||
The world will only be downloaded or copied if it doesn't exist already. Set `FORCE_WORLD_COPY=TRUE` to force overwrite the world on every server start.
|
||||
|
||||
### Datapacks
|
||||
Datapacks can be installed in a similar manner to mods/plugins. There are many environment variables which function in the same way they do for [mods](#working-with-mods-and-plugins):
|
||||
* `DATAPACKS`
|
||||
* `DATAPACKS_FILE`
|
||||
* `REMOVE_OLD_DATAPACKS`
|
||||
* `REMOVE_OLD_DATAPACKS_DEPTH`
|
||||
* `REMOVE_OLD_DATAPACKS_INCLUDE`
|
||||
* `REMOVE_OLD_DATAPACKS_EXCLUDE`
|
||||
Datapacks will be placed in `/data/$LEVEL/datapacks`
|
||||
|
||||
## Server configuration
|
||||
|
||||
By default, the server configuration will be created and set based on the following environment variables, but only the first time the server is started. If the `server.properties` file already exists, the values in them will not be changed.
|
||||
@@ -1471,28 +1465,6 @@ The following environment variables define the behaviour of auto-pausing:
|
||||
* `AUTOPAUSE_KNOCK_INTERFACE`, default `eth0`
|
||||
<br>Describes the interface passed to the `knockd` daemon. If the default interface does not work, run the `ifconfig` command inside the container and derive the interface receiving the incoming connection from its output. The passed interface must exist inside the container. Using the loopback interface (`lo`) does likely not yield the desired results.
|
||||
|
||||
## Autostop
|
||||
|
||||
An option to stop the server after a specified time has been added for niche applications (e.g. billing saving on AWS Fargate). The function is incompatible with the Autopause functionality, as they basically cancel out each other.
|
||||
|
||||
Note that the docker container variables have to be set accordingly (restart policy set to "no") and that the container has to be manually restarted.
|
||||
|
||||
A starting, example compose file has been provided in [examples/docker-compose-autostop.yml](examples/docker-compose-autostop.yml).
|
||||
|
||||
Enable the Autostop functionality by setting:
|
||||
|
||||
```
|
||||
-e ENABLE_AUTOSTOP=TRUE
|
||||
```
|
||||
|
||||
The following environment variables define the behaviour of auto-stopping:
|
||||
* `AUTOSTOP_TIMEOUT_EST`, default `3600` (seconds)
|
||||
describes the time between the last client disconnect and the stopping of the server (read as timeout established)
|
||||
* `AUTOSTOP_TIMEOUT_INIT`, default `1800` (seconds)
|
||||
describes the time between server start and the stopping of the server, when no client connects inbetween (read as timeout initialized)
|
||||
* `AUTOSTOP_PERIOD`, default `10` (seconds)
|
||||
describes period of the daemonized state machine, that handles the stopping of the server
|
||||
|
||||
## Running on RaspberryPi
|
||||
|
||||
To run this image on a RaspberryPi 3 B+, 4, or newer, use any of the image tags [list in the Java version section](#running-minecraft-server-on-different-java-version) that specify `armv7` for the architecture, which includes `itzg/minecraft-server:latest`.
|
||||
|
||||
@@ -12,4 +12,4 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gosu minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
|
||||
echo "$@" > "${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}"
|
||||
@@ -1,20 +0,0 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
minecraft:
|
||||
image: itzg/minecraft-server
|
||||
ports:
|
||||
- "25565:25565"
|
||||
volumes:
|
||||
- "mc:/data"
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
ENABLE_AUTOSTOP: "TRUE"
|
||||
# More aggressive settings for demo purposes
|
||||
AUTOSTOP_TIMEOUT_INIT: "30"
|
||||
AUTOSTOP_TIMEOUT_EST: "20"
|
||||
# Important not to auto-restart the server!!!
|
||||
restart: "no"
|
||||
|
||||
volumes:
|
||||
mc: {}
|
||||
@@ -1,19 +1,18 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
container_name: paper
|
||||
environment:
|
||||
EULA: "true"
|
||||
ENABLE_RCON: "true"
|
||||
TYPE: PAPER
|
||||
VIEW_DISTANCE: 10
|
||||
MEMORY: 2G
|
||||
VERSION: 1.9.4
|
||||
# needed for Paper versions before 1.14
|
||||
CONSOLE: "false"
|
||||
ports:
|
||||
- 25565:25565
|
||||
volumes:
|
||||
- mc-paper:/data
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
mc-paper:
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# needed for the clients connected function residing in autopause
|
||||
. /autopause/autopause-fcns.sh
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
|
||||
# wait for java process to be started
|
||||
while :
|
||||
do
|
||||
if java_process_exists ; then
|
||||
break
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
STATE=INIT
|
||||
|
||||
while :
|
||||
do
|
||||
case X$STATE in
|
||||
XINIT)
|
||||
# Server startup
|
||||
if mc_server_listening ; then
|
||||
TIME_THRESH=$(($(current_uptime)+$AUTOSTOP_TIMEOUT_INIT))
|
||||
logAutostop "MC Server listening for connections - stopping in $AUTOSTOP_TIMEOUT_INIT seconds"
|
||||
STATE=II
|
||||
fi
|
||||
;;
|
||||
XII)
|
||||
# Initial idle
|
||||
if java_clients_connected ; then
|
||||
logAutostop "Client connected - waiting for disconnect"
|
||||
STATE=E
|
||||
else
|
||||
if [[ $(current_uptime) -ge $TIME_THRESH ]] ; then
|
||||
logAutostop "No client connected since startup - stopping server"
|
||||
/autostop/stop.sh
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
XE)
|
||||
# Established
|
||||
if ! java_clients_connected ; then
|
||||
TIME_THRESH=$(($(current_uptime)+$AUTOSTOP_TIMEOUT_EST))
|
||||
logAutostop "All clients disconnected - stopping in $AUTOSTOP_TIMEOUT_EST seconds"
|
||||
STATE=I
|
||||
fi
|
||||
;;
|
||||
XI)
|
||||
# Idle
|
||||
if java_clients_connected ; then
|
||||
logAutostop "Client reconnected - waiting for disconnect"
|
||||
STATE=E
|
||||
else
|
||||
if [[ $(current_uptime) -ge $TIME_THRESH ]] ; then
|
||||
logAutostop "No client reconnected - stopping"
|
||||
/autostop/stop.sh
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
logAutostop "Error: invalid state: $STATE"
|
||||
;;
|
||||
esac
|
||||
sleep $AUTOSTOP_PERIOD
|
||||
done
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /start-utils
|
||||
|
||||
logAutostopAction "Stopping Java process"
|
||||
kill -SIGTERM 1
|
||||
@@ -40,7 +40,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
|
||||
echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||
fi
|
||||
|
||||
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration "$@"
|
||||
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
||||
else
|
||||
exec ${SCRIPTS:-/}start-configuration "$@"
|
||||
exec ${SCRIPTS:-/}start-configuration $@
|
||||
fi
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck source=start-utils
|
||||
. "${SCRIPTS:-/}start-utils"
|
||||
|
||||
: "${SERVER_PORT:=25565}"
|
||||
export SERVER_PORT
|
||||
|
||||
log "Autostop functionality enabled"
|
||||
|
||||
isDebugging && set -x
|
||||
|
||||
if ! [[ $AUTOSTOP_PERIOD =~ ^[0-9]+$ ]]; then
|
||||
AUTOSTOP_PERIOD=10
|
||||
export AUTOSTOP_PERIOD
|
||||
log "Warning: AUTOSTOP_PERIOD is not numeric, set to 10 (seconds)"
|
||||
fi
|
||||
if [ "$AUTOSTOP_PERIOD" -eq "0" ] ; then
|
||||
AUTOSTOP_PERIOD=10
|
||||
export AUTOSTOP_PERIOD
|
||||
log "Warning: AUTOSTOP_PERIOD must not be 0, set to 10 (seconds)"
|
||||
fi
|
||||
if ! [[ $AUTOSTOP_TIMEOUT_EST =~ ^[0-9]+$ ]] ; then
|
||||
AUTOSTOP_TIMEOUT_EST=3600
|
||||
export AUTOSTOP_TIMEOUT_EST
|
||||
log "Warning: AUTOSTOP_TIMEOUT_EST is not numeric, set to 3600 (seconds)"
|
||||
fi
|
||||
if ! [[ $AUTOSTOP_TIMEOUT_INIT =~ ^[0-9]+$ ]] ; then
|
||||
AUTOSTOP_TIMEOUT_INIT=1800
|
||||
export AUTOSTOP_TIMEOUT_INIT
|
||||
log "Warning: AUTOSTOP_TIMEOUT_INIT is not numeric, set to 1800 (seconds)"
|
||||
fi
|
||||
|
||||
/autostop/autostop-daemon.sh &
|
||||
@@ -37,11 +37,6 @@ if isTrue "${ENABLE_AUTOPAUSE}" && isTrue "${EXEC_DIRECTLY:-false}"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if isTrue "${ENABLE_AUTOPAUSE}" && isTrue "${ENABLE_AUTOSTOP}"; then
|
||||
log "ENABLE_AUTOPAUSE=true is incompatible with ENABLE_AUTOSTOP=true"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $PROXY ]]; then
|
||||
export http_proxy="$PROXY"
|
||||
export https_proxy="$PROXY"
|
||||
@@ -101,10 +96,6 @@ if isTrue "${ENABLE_AUTOPAUSE}"; then
|
||||
${SCRIPTS:-/}start-autopause
|
||||
fi
|
||||
|
||||
if isTrue "${ENABLE_AUTOSTOP}"; then
|
||||
${SCRIPTS:-/}start-autostop
|
||||
fi
|
||||
|
||||
if versionLessThan 1.7; then
|
||||
echo "
|
||||
MC_HEALTH_EXTRA_ARGS=(
|
||||
|
||||
@@ -6,8 +6,8 @@ isDebugging && set -x
|
||||
|
||||
IFS=$'\n\t'
|
||||
|
||||
if [ "${VERSION}" != "LATEST" ] && [ "${VERSION}" != "1.17" ] && [ "${VERSION}" != "PURPUR" ] ; then
|
||||
log "ERROR: Airplane server type only supports VERSION=LATEST, VERSION=1.17, VERSION=PURPUR. Note that these are branches, not #.#.# versions."
|
||||
if [ "${VERSION}" != "LATEST" ] && [ "${VERSION}" != "1.16" ] && [ "${VERSION}" != "1.17" ] && [ "${VERSION}" != "PURPUR" ] && [ "${VERSION}" != "PURPUR-1.16" ] ; then
|
||||
log "ERROR: Airplane server type only supports VERSION=LATEST, VERSION=1.17, VERSION=1.16, VERSION=PURPUR or VERSION=PURPUR-1.16. Note that these are branches, not #.#.# versions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -18,11 +18,20 @@ if [ "${VERSION}" = "LATEST" ] || [ "${VERSION}" = "1.17" ]; then
|
||||
AIRPLANE_BRANCH="1.17"
|
||||
fi
|
||||
|
||||
if [ "${VERSION}" = "1.16" ]; then
|
||||
AIRPLANE_BRANCH="1.16"
|
||||
fi
|
||||
|
||||
if [ "${VERSION}" = "PURPUR" ]; then
|
||||
AIRPLANE_BRANCH="Purpur-1.17"
|
||||
AIRPLANE_TYPE="airplanepurpur"
|
||||
fi
|
||||
|
||||
if [ "${VERSION}" = "PURPUR-1.16" ]; then
|
||||
AIRPLANE_BRANCH="Purpur-1.16"
|
||||
AIRPLANE_TYPE="airplanepurpur"
|
||||
fi
|
||||
|
||||
log "Using Airplane-${AIRPLANE_BRANCH} branch"
|
||||
|
||||
export SERVER=airplane-${AIRPLANE_BRANCH}-${AIRPLANE_BUILD}.jar
|
||||
|
||||
@@ -2,31 +2,27 @@
|
||||
set -eu
|
||||
|
||||
# shellcheck source=start-utils
|
||||
. "${SCRIPTS:-/}start-utils"
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
|
||||
requireVar VANILLA_VERSION
|
||||
export TYPE=FABRIC
|
||||
: "${FABRIC_INSTALLER_VERSION:=${FABRICVERSION:-LATEST}}"
|
||||
: "${FABRIC_INSTALLER:=}"
|
||||
: "${FABRIC_INSTALLER_URL:=}"
|
||||
: "${FABRIC_LOADER_VERSION:=LATEST}"
|
||||
export SERVER=fabric-server-${VANILLA_VERSION}.jar
|
||||
|
||||
isDebugging && set -x
|
||||
|
||||
log "Checking Fabric version information."
|
||||
if [[ $FABRIC_INSTALLER ]]; then
|
||||
FABRIC_INSTALLER_VERSION=$(echo -n "$FABRIC_INSTALLER" | mc-image-helper hash)
|
||||
elif [[ $FABRIC_INSTALLER_URL ]]; then
|
||||
FABRIC_INSTALLER_VERSION=$(echo -n "$FABRIC_INSTALLER_URL" | mc-image-helper hash)
|
||||
elif [[ ${FABRIC_INSTALLER_VERSION^^} = LATEST ]]; then
|
||||
FABRIC_INSTALLER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
|
||||
fi
|
||||
if [[ ! -e ${SERVER} ]]; then
|
||||
|
||||
export SERVER=fabric-server-${VANILLA_VERSION}-${FABRIC_INSTALLER_VERSION}.jar
|
||||
|
||||
if [ ! \( -e ${SERVER} -a -e "server-${VANILLA_VERSION}.jar" \) ]; then
|
||||
: ${FABRIC_INSTALLER:=}
|
||||
: ${FABRIC_INSTALLER_URL:=}
|
||||
: ${FABRIC_LOADER_VERSION:=LATEST}
|
||||
: ${FABRIC_INSTALLER_VERSION:=${FABRICVERSION:-LATEST}}
|
||||
|
||||
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
|
||||
log "Checking Fabric version information."
|
||||
if [[ ${FABRIC_INSTALLER_VERSION^^} = LATEST ]]; then
|
||||
FABRIC_INSTALLER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
|
||||
fi
|
||||
|
||||
FABRIC_INSTALLER="fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
|
||||
FABRIC_INSTALLER_URL="https://maven.fabricmc.net/net/fabricmc/fabric-installer/${FABRIC_INSTALLER_VERSION}/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
|
||||
elif [[ -z $FABRIC_INSTALLER ]]; then
|
||||
@@ -70,12 +66,8 @@ if [ ! \( -e ${SERVER} -a -e "server-${VANILLA_VERSION}.jar" \) ]; then
|
||||
exit 10
|
||||
fi
|
||||
|
||||
mv server.jar "server-${VANILLA_VERSION}.jar"
|
||||
mv fabric-server-launch.jar "${SERVER}"
|
||||
fi
|
||||
|
||||
# Specify which server jar to run
|
||||
echo "serverJar=server-${VANILLA_VERSION}.jar" > fabric-server-launcher.properties
|
||||
|
||||
export FAMILY=FABRIC
|
||||
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||
exec ${SCRIPTS:-/}start-setupWorld "$@"
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
: "${REMOVE_OLD_DATAPACKS:=false}"
|
||||
: "${DATAPACKS_FILE:=}"
|
||||
: "${REMOVE_OLD_DATAPACKS_DEPTH:=1} "
|
||||
: "${REMOVE_OLD_DATAPACKS_INCLUDE:=*.zip}"
|
||||
|
||||
# shellcheck source=start-utils
|
||||
. "${SCRIPTS:-/}start-utils"
|
||||
isDebugging && set -x
|
||||
|
||||
out_dir=/data/${LEVEL:-world}/datapacks
|
||||
|
||||
# Remove old datapacks
|
||||
if isTrue "${REMOVE_OLD_DATAPACKS}" && [ -z "${DATAPACKS_FILE}" ]; then
|
||||
if [ -d "$out_dir" ]; then
|
||||
find "$out_dir" -mindepth 1 -maxdepth ${REMOVE_OLD_DATAPACKS_DEPTH:-16} -wholename "${REMOVE_OLD_DATAPACKS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_DATAPACKS_EXCLUDE:-}" -delete
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$DATAPACKS" ]]; then
|
||||
mkdir -p "$out_dir"
|
||||
|
||||
for i in ${DATAPACKS//,/ }
|
||||
do
|
||||
if isURL "$i"; then
|
||||
log "Downloading datapack $i ..."
|
||||
if ! get -o "${out_dir}" "$i"; then
|
||||
log "ERROR: failed to download from $i into $out_dir"
|
||||
exit 2
|
||||
fi
|
||||
elif [[ -f "$i" && "$i" =~ .*\.zip ]]; then
|
||||
log "Copying datapack located at $i ..."
|
||||
out_file=$(basename "$i")
|
||||
if ! cp "$i" "${out_dir}/$out_file"; then
|
||||
log "ERROR: failed to copy from $i into $out_dir"
|
||||
exit 2
|
||||
fi
|
||||
elif [[ -d "$i" ]]; then
|
||||
log "Copying datapacks from $i ..."
|
||||
cp "$i"/*.zip "${out_dir}"
|
||||
else
|
||||
log "ERROR Invalid URL or path given in DATAPACKS: $i"
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
|
||||
elif [[ "$DATAPACKS_FILE" ]]; then
|
||||
if [ ! -f "$DATAPACKS_FILE" ]; then
|
||||
log "ERROR: given DATAPACKS_FILE file does not exist"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
mkdir -p "$out_dir"
|
||||
|
||||
args=(
|
||||
-o "${out_dir}"
|
||||
--log-progress-each
|
||||
--skip-existing
|
||||
--uris-file "${DATAPACKS_FILE}"
|
||||
)
|
||||
if isTrue "${REMOVE_OLD_DATAPACKS}"; then
|
||||
args+=(
|
||||
--prune-others "${REMOVE_OLD_DATAPACKS_INCLUDE}"
|
||||
--prune-depth "${REMOVE_OLD_DATAPACKS_DEPTH}"
|
||||
)
|
||||
fi
|
||||
|
||||
if ! get "${args[@]}" ; then
|
||||
log "ERROR: failed to retrieve one or more datapacks"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "${SCRIPTS:-/}start-setupModpack" "$@"
|
||||
@@ -69,4 +69,4 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "${SCRIPTS:-/}start-setupDatapack" "$@"
|
||||
exec "${SCRIPTS:-/}start-setupModpack" "$@"
|
||||
|
||||
@@ -22,20 +22,6 @@ containsJars() {
|
||||
return 1
|
||||
}
|
||||
|
||||
containsPlugin() {
|
||||
file=${1?}
|
||||
|
||||
pat='plugin.yml$'
|
||||
|
||||
while read -r line; do
|
||||
if [[ $line =~ $pat ]]; then
|
||||
return 0
|
||||
fi
|
||||
done <<<$(unzip -l "$file")
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
getResourceFromSpiget() {
|
||||
resource=${1?}
|
||||
|
||||
@@ -95,12 +81,9 @@ downloadResourceFromSpiget() {
|
||||
log "Extracting contents of resource ${resource} into plugins"
|
||||
unzip -o -q -d /data/plugins "${tmpfile}"
|
||||
rm "${tmpfile}"
|
||||
elif containsPlugin "${tmpfile}"; then
|
||||
else
|
||||
log "Moving resource ${resource} into plugins"
|
||||
mv "${tmpfile}" "/data/plugins/${resource}.jar"
|
||||
else
|
||||
log "ERROR downloaded resource '${resource}' seems to be not a valid plugin"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
@@ -93,14 +93,6 @@ function logAutopauseAction() {
|
||||
echo "[$(date -Iseconds)] [Autopause] $*"
|
||||
}
|
||||
|
||||
function logAutostop() {
|
||||
echo "[Autostop loop] $*"
|
||||
}
|
||||
|
||||
function logAutostopAction() {
|
||||
echo "[$(date -Iseconds)] [Autostop] $*"
|
||||
}
|
||||
|
||||
function normalizeMemSize() {
|
||||
local scale=1
|
||||
case ${1,,} in
|
||||
|
||||
Reference in New Issue
Block a user