From 4c781b424c16cf0eb407132a19b0c6795dfab90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Sat, 25 Feb 2023 08:49:57 +0100 Subject: [PATCH] Add first run question --- launch.cfg | 2 +- msman.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/launch.cfg b/launch.cfg index 6c079a2..94533de 100644 --- a/launch.cfg +++ b/launch.cfg @@ -41,7 +41,7 @@ mem="6000M" mc_launchoptions="-nogui" # 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 # ---------------------------------------------------------------------------------- diff --git a/msman.sh b/msman.sh index ef3c9d7..78effdb 100755 --- a/msman.sh +++ b/msman.sh @@ -149,6 +149,7 @@ function ask_server_differs { # Accept EULA function accept_eula { 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 "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)." @@ -343,6 +344,21 @@ function load_script { 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 function main { # Check dependencies @@ -377,6 +393,9 @@ function main { # Accept EULA accept_eula + # Check if this is the first run + first_run + # Launch the server launch_server }