diff --git a/build_images.sh b/build_images.sh new file mode 100755 index 0000000..497bebe --- /dev/null +++ b/build_images.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +cd paper +./build_all_versions.sh +cd .. + +cd velocity +docker build -t mrletsplay/velocity . +cd .. diff --git a/velocity/bin/configure_and_start b/velocity/bin/configure_and_start index 17de863..7614f9b 100755 --- a/velocity/bin/configure_and_start +++ b/velocity/bin/configure_and_start @@ -2,19 +2,6 @@ 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 version=$(curl -X GET $apiURL | jq -r ".versions[-1]") @@ -29,5 +16,23 @@ echo "Full URL is: $url" echo "Downloading to $PWD" 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 "> $@" exec "$@"