42 lines
No EOL
983 B
Bash
Executable file
42 lines
No EOL
983 B
Bash
Executable file
#!/usr/bin/env sh
|
|
set -e
|
|
|
|
test -n "$MC_VERSION" || {
|
|
>&2 echo "MC_VERSION unset"
|
|
exit 1
|
|
}
|
|
|
|
test -n "$BUILT_PLUGIN" || {
|
|
>&2 echo "BUILT_PLUGIN unset"
|
|
exit 1
|
|
}
|
|
|
|
BUILT_PLUGIN="$(realpath "$BUILD_WORKSPACE_DIRECTORY/$BUILT_PLUGIN")"
|
|
test -e "$BUILT_PLUGIN" || {
|
|
>&2 echo "$BUILT_PLUGIN does not exist"
|
|
exit 1
|
|
}
|
|
|
|
mkdir -p "$BUILD_WORKSPACE_DIRECTORY/run"
|
|
cd "$BUILD_WORKSPACE_DIRECTORY/run"
|
|
printf 'eula=true' > eula.txt
|
|
|
|
server="paper-${MC_VERSION}.jar"
|
|
test -f "$server" || {
|
|
>&2 echo "$server not found. downloading..."
|
|
url="$(curl -Ls "https://fill.papermc.io/v3/projects/paper/versions/$MC_VERSION/builds/latest" \
|
|
| jq -r '.downloads."server:default".url')"
|
|
curl -L -o "$server" "$url"
|
|
}
|
|
|
|
# shellcheck disable=SC2068
|
|
for arg in $@; do
|
|
name="$(echo "$arg" | cut -d= -f1)"
|
|
url="$(echo "$arg" | cut -d= -f2)"
|
|
plugin="plugins/$name"
|
|
test -f "$plugin" || curl -Lo "$plugin" "$url"
|
|
done
|
|
|
|
exec java -jar "$server" \
|
|
--nogui \
|
|
--add-plugin "$BUILT_PLUGIN" |