Use new paper config if possible

This commit is contained in:
MrLetsplay 2023-04-08 22:31:04 +02:00
parent d088798886
commit cef3b0572f
3 changed files with 40 additions and 22 deletions

View File

@ -8,8 +8,7 @@ RUN apk add --upgrade sudo shadow $JAVA curl jq
ADD ./bin /usr/local/bin ADD ./bin /usr/local/bin
RUN groupadd -g $GID minecraft RUN useradd minecraft
RUN useradd -u $UID -g $GID minecraft
RUN mkdir /minecraft && chown -R minecraft /minecraft RUN mkdir /minecraft && chown -R minecraft /minecraft
@ -22,5 +21,8 @@ EXPOSE 25565
ARG MC_VERSION ARG MC_VERSION
ENV MC_VERSION=${MC_VERSION:-1.19.4} ENV MC_VERSION=${MC_VERSION:-1.19.4}
ARG PAPER_NEW_CONFIG
ENV PAPER_NEW_CONFIG=${PAPER_NEW_CONFIG:-false}
ENTRYPOINT ["setup"] ENTRYPOINT ["setup"]
CMD ["java", "-Xmx2G", "-Xms2G", "-jar", "paper.jar"] CMD ["java", "-Xmx2G", "-Xms2G", "-jar", "paper.jar"]

View File

@ -3,28 +3,44 @@
meta_dir="docker_meta" meta_dir="docker_meta"
if test ! -f "$meta_dir/config_done"; then if test ! -f "$meta_dir/config_done"; then
# TODO: Use config/paper-global.yml with new config keys for 1.19+ Paper if test "$PAPER_NEW_CONFIG" != "true"; then
config_path="paper.yml" config_path="paper.yml"
else
mkdir "config"
config_path="config/paper-global.yml"
fi
config="" config=""
if test "$VELOCITY_ENABLE" = "true"; then if test "$VELOCITY_ENABLE" = "true"; then
echo "online-mode=false" > server.properties echo "online-mode=false" > server.properties
velocity=$(cat << EOF if test "$PAPER_NEW_CONFIG" != "true"; then
velocity=$(cat << EOF
settings: settings:
velocity-support: velocity-support:
enabled: true enabled: true
online-mode: true online-mode: true
secret: '$VELOCITY_SECRET' secret: '$VELOCITY_SECRET'
EOF EOF
) )
else
velocity=$(cat << EOF
proxies:
velocity:
enabled: true
online-mode: true
secret: '$VELOCITY_SECRET'
EOF
)
fi
config="${config}${velocity}" config="${config}${velocity}"
fi fi
if test ! -z "$config"; then if test ! -z "$config"; then
echo "Writing config" echo "Writing config to $config_path"
echo "$config" > $config_path echo "$config" > $config_path
fi fi

View File

@ -3,21 +3,21 @@
#!/bin/sh #!/bin/sh
declare -A versions declare -A versions
versions["1.8.8"]=openjdk8 versions["1.8.8"]="openjdk8 false"
versions["1.9.4"]=openjdk8 versions["1.9.4"]="openjdk8 false"
versions["1.10.2"]=openjdk8 versions["1.10.2"]="openjdk8 false"
versions["1.11.2"]=openjdk8 versions["1.11.2"]="openjdk8 false"
versions["1.12.2"]=openjdk8 versions["1.12.2"]="openjdk8 false"
versions["1.13.2"]=openjdk8 versions["1.13.2"]="openjdk8 false"
versions["1.14.4"]=openjdk8 versions["1.14.4"]="openjdk8 false"
versions["1.15.2"]=openjdk8 versions["1.15.2"]="openjdk8 false"
versions["1.16.5"]=openjdk8 versions["1.16.5"]="openjdk8 false"
versions["1.17.1"]=openjdk8 versions["1.17.1"]="openjdk8 false"
versions["1.18.2"]=openjdk17 versions["1.18.2"]="openjdk17 false"
versions["1.19.4"]=openjdk17 versions["1.19.4"]="openjdk17 true"
for version in "${!versions[@]}"; do for version in "${!versions[@]}"; do
java_version="${versions[$version]}" params=(${versions[$version]})
echo $version $java_version echo "Building version $version, JAVA=${params[0]}, PAPER_NEW_CONFIG=${params[1]}"
docker build --build-arg MC_VERSION=$version --build-arg JAVA=$java_version -t mrletsplay/paper:$version . docker build --build-arg MC_VERSION=$version --build-arg JAVA=${params[0]} --build-arg PAPER_NEW_CONFIG=${params[1]} -t mrletsplay/paper:$version .
done done