Browse Source

new: [minecraft] add type of install and ``paper`` type

odoo_fix_webhook_url
Valentin Lab 1 year ago
parent
commit
8e5c22e75a
  1. 30
      minecraft/README.org
  2. 3
      minecraft/hooks/init
  3. 24
      minecraft/lib/common

30
minecraft/README.org

@ -0,0 +1,30 @@
* Usage
#+begin_src yaml
minecraft:
options:
type: paper ## legacy or paper
version: 1.20.1-32
threads: 8
mem: 2048M
properties:
gamemode: survival
view-distance: 16
ops:
foo:
uuid: 7217ab76-1b23-4884-9072-d81f63ef6c23
level: 4
bypassesPlayerLimit: false
whitelist:
7217ab76-1b23-4884-9072-d81f63ef6c23: foo
8481e720-33fa-48b2-a3be-610e81bae897: bar
#+end_src
* Version
The version option provided should be:
- For =type= ~paper~ any released version found on their website.
- For =type= ~legacy~ (default value), should be one of the following
version: ~1.6.2~, ~1.7.2~, ~1.7.9~, ~1.8.1~, ~1.8~, ~1.9.4~,
~1.10.2~, ~1.10~, ~1.11.2~, ~1.11~, ~1.12.1~, ~1.12.2~, ~1.12~,
~1.13.1~, ~1.13.2~, ~1.13~, ~1.19.4~, ~1.20.0~

3
minecraft/hooks/init

@ -16,8 +16,9 @@
set -e set -e
version=$(options-get version) || exit 1 version=$(options-get version) || exit 1
type=$(options-get type) || exit 1
minecraft:init-binary "$version"
minecraft:init-binary "${type:-legacy}" "$version"
threads=$(options-get threads) || exit 1 threads=$(options-get threads) || exit 1
mem=$(options-get mem) || exit 1 mem=$(options-get mem) || exit 1

24
minecraft/lib/common

@ -5,18 +5,30 @@ MINECRAFT_PATH="$SERVICE_CONFIGSTORE/opt/apps/minecraft"
MINECRAFT_DATA="/var/lib/minecraft" MINECRAFT_DATA="/var/lib/minecraft"
minecraft:init-binary() { minecraft:init-binary() {
local version="$1"
MINECRAFT_BINARY="${MINECRAFT_PATH}/minecraft_server.${version}.jar"
local type="$1" version="$2"
case "$type" in
"legacy")
MINECRAFT_URL="https://docker.0k.io/downloads/minecraft_server.${version}.jar"
MINECRAFT_BINARY="minecraft_server.${version}.jar"
;;
"paper")
MINECRAFT_URL="https://api.papermc.io/v2/projects/paper/versions/${version%-*}/builds/${version##*-}/downloads/paper-${version}.jar"
MINECRAFT_BINARY="paper.${version}.jar"
;;
*)
err "Unknown ${WHITE}type${NORMAL} '$type'. Please use on of: legacy, paper"
exit 1
;;
esac
if ! [ -f "$MINECRAFT_BINARY" ]; then if ! [ -f "$MINECRAFT_BINARY" ]; then
mkdir -p "${MINECRAFT_PATH}" mkdir -p "${MINECRAFT_PATH}"
wget "https://docker.0k.io/downloads/minecraft_server.${version}.jar" \
-O "$MINECRAFT_BINARY"
wget "$MINECRAFT_URL" -O "$MINECRAFT_PATH/$MINECRAFT_BINARY" || exit 1
fi fi
init-config-add " init-config-add "
$SERVICE_NAME: $SERVICE_NAME:
volumes: volumes:
- \"${MINECRAFT_BINARY}:${MINECRAFT_DATA}/server.jar\"
- \"$MINECRAFT_PATH/${MINECRAFT_BINARY}:${MINECRAFT_DATA}/server.jar\"
" "
} }

Loading…
Cancel
Save