Configure Velocity player forwarding mode

This commit is contained in:
MrLetsplay 2023-04-05 22:19:06 +02:00
parent f91db020e6
commit 69970e47b2
2 changed files with 27 additions and 13 deletions

9
build_images.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
cd paper
./build_all_versions.sh
cd ..
cd velocity
docker build -t mrletsplay/velocity .
cd ..

View File

@ -2,19 +2,6 @@
meta_dir="docker_meta" meta_dir="docker_meta"
if test ! -f "$meta_dir/setup_done"; then
if test "$VELOCITY_SECRET" = "REPLACE_THIS_WITH_A_RANDOM_SECRET"; then
echo "Refusing to configure Velocity with insecure secret"
exit 1
fi
echo "$VELOCITY_SECRET" > forwarding.secret
mkdir -p "$meta_dir" && touch "$meta_dir/setup_done"
else
echo "Setup is done"
fi
apiURL=https://api.papermc.io/v2/projects/velocity apiURL=https://api.papermc.io/v2/projects/velocity
version=$(curl -X GET $apiURL | jq -r ".versions[-1]") version=$(curl -X GET $apiURL | jq -r ".versions[-1]")
@ -29,5 +16,23 @@ echo "Full URL is: $url"
echo "Downloading to $PWD" echo "Downloading to $PWD"
wget -O velocity.jar $url wget -O velocity.jar $url
if test ! -f "$meta_dir/setup_done"; then
if test "$VELOCITY_SECRET" = "REPLACE_THIS_WITH_A_RANDOM_SECRET"; then
echo "Refusing to configure Velocity with insecure secret"
exit 1
fi
echo "$VELOCITY_SECRET" > forwarding.secret
echo "Running velocity to generate configs"
echo shutdown | java -jar velocity.jar
sed -i 's/player-info-forwarding-mode.*$/player-info-forwarding-mode = "MODERN"/g' velocity.toml
mkdir -p "$meta_dir" && touch "$meta_dir/setup_done"
else
echo "Setup is done"
fi
echo "> $@" echo "> $@"
exec "$@" exec "$@"