Initial release #1

Merged
jiriks74 merged 48 commits from initial_release into main 2023-02-26 23:56:32 +01:00
2 changed files with 20 additions and 1 deletions
Showing only changes of commit 4c781b424c - Show all commits

@ -41,7 +41,7 @@ mem="6000M"
mc_launchoptions="-nogui" mc_launchoptions="-nogui"
# If you want to get rid of script updates notifications, set the below to false # If you want to get rid of script updates notifications, set the below to false
check_for_script_updates=true check_for_script_updates=false
# The options below are for advanced users, modification is not needed in most cases # The options below are for advanced users, modification is not needed in most cases
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------

@ -149,6 +149,7 @@ function ask_server_differs {
# Accept EULA # Accept EULA
function accept_eula { function accept_eula {
if test "$(cat eula.txt 2>/dev/null)" != "eula=true"; then if test "$(cat eula.txt 2>/dev/null)" != "eula=true"; then
first_run=true
echo "'eula.txt' does not exist or EULA is not accepted" echo "'eula.txt' does not exist or EULA is not accepted"
echo "You have to accept the Minecraft EULA to run the server" echo "You have to accept the Minecraft EULA to run the server"
echo "By entering 'y' you are indicating your agreement to Minecraft's EULA (https://aka.ms/MinecraftEULA)." echo "By entering 'y' you are indicating your agreement to Minecraft's EULA (https://aka.ms/MinecraftEULA)."
@ -343,6 +344,21 @@ function load_script {
fi fi
} }
# First run
first_run() {
if [[ $first_run == true ]]; then
answer=""
echo "Since eula wasn't accepted, this is probably the first run of the server"
echo "If you want to install plugins (or mods), answer 'n' and you can do so."
echo "If you don't answer, the server will start in 15 secondd."
read -t 15 -p "Do you want to start the server now? [Y/n] " answer
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
echo "Exiting..."
exit 0
fi
fi
}
# Main function # Main function
function main { function main {
# Check dependencies # Check dependencies
@ -377,6 +393,9 @@ function main {
# Accept EULA # Accept EULA
accept_eula accept_eula
# Check if this is the first run
first_run
# Launch the server # Launch the server
launch_server launch_server
} }