#!/bin/sh

# Server Launch Script
#
# Thrown together by Neeve in under five minutes, Public Domain
# https://github.com/Neeve01
#
# Fixed and added java version check by t0suj4, Public Domain
# https://github.com/t0suj4

# DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING
FORGEJAR='forge-1.12.2-14.23.5.2860.jar'
JAVA_PARAMETERS=''

# these you can edit
MIN_RAM='2048M'
MAX_RAM='2048M'

# DO NOT EDIT ANYTHING PAST THIS LINE, except to remove the nogui
LAUNCHPARAMS="-server -Xms$MIN_RAM -Xmx$MAX_RAM $JAVA_PARAMETERS -jar $FORGEJAR nogui"

echo "Checking java version..."
echo
java -version
echo
echo "The expected java version is 1.8. Not higher, not lower."
echo

echo "Launching the server..."
echo
echo "> java $LAUNCHPARAMS"

java $LAUNCHPARAMS

echo
echo "- The server has stopped. If it's a crash, please read the output above."
echo
read -p "- Press Return to exit..." _
