Просмотр исходного кода

feat(newserver): Minecraft Bedrock (#2626)

Daniel Gibbs 6 лет назад
Родитель
Сommit
86478573d9

+ 157 - 0
lgsm/config-default/config-lgsm/mcbserver/_default.cfg

@@ -0,0 +1,157 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either:
+# common.cfg - applies settings to every instance.
+# [instance].cfg - applies settings to a specific instance.
+
+#### Game Server Settings ####
+
+## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+fn_parms(){
+parms=""
+}
+
+#### LinuxGSM Settings ####
+
+## LinuxGSM Stats
+# Send useful stats to LinuxGSM developers.
+# https://docs.linuxgsm.com/configuration/linuxgsm-stats
+# (on|off)
+stats="off"
+
+## Notification Alerts
+# (on|off)
+
+# Display IP | https://docs.linuxgsm.com/alerts#display-ip
+displayip=""
+
+# More info | https://docs.linuxgsm.com/alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://hastebin.com"
+
+# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://docs.linuxgsm.com/alerts/email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+
+# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
+slackalert="off"
+slackwebhook="webhook"
+
+# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
+# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring".
+# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need
+# any custom string in curl - simple ignore this parameter.
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+curlcustomstring=""
+
+## Updating | https://docs.linuxgsm.com/commands/update
+updateonstart="off"
+
+## Backup | https://docs.linuxgsm.com/commands/backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://docs.linuxgsm.com/features/logging
+consolelogging="on"
+logdays="7"
+
+## Monitor | https://docs.linuxgsm.com/commands/monitor
+# Query delay time
+querydelay="1"
+
+## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
+ansi="on"
+
+#### Advanced Settings ####
+
+## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
+sleeptime="0.5"
+
+## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
+# 1: tmux kill
+# 2: CTRL+c
+# 3: quit
+# 4: quit 120s
+# 5: stop
+# 6: q
+# 7: exit
+# 8: 7 Days to Die
+# 9: Gold Source
+# 10: Teamspeak 3
+stopmode="5"
+
+## Query mode
+# 1: session only
+# 2: gamedig + gsquery
+# 3: gamedig
+# 4: gsquery
+# 5: tcp
+querymode="4"
+querytype="minecraftbe"
+
+## Game Server Details
+# Do not edit
+gamename="Minecraft Bedrock"
+engine="bedrock"
+glibc="2.27"
+
+#### Directories ####
+# Edit with care
+
+## Game Server Directories
+systemdir="${serverfiles}"
+executabledir="${serverfiles}"
+executable="${serverfiles}/bedrock_server"
+servercfg="server.properties"
+servercfgdefault="server.properties"
+servercfgdir="${serverfiles}"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${lgsmdir}/backup"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${systemdir}"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${selfname}-script.log"
+consolelog="${consolelogdir}/${selfname}-console.log"
+alertlog="${lgsmlogdir}/${selfname}-alert.log"
+postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

+ 1 - 0
lgsm/config-default/config-lgsm/mcserver/_default.cfg

@@ -15,6 +15,7 @@ javaram="1024" # -Xmx$1024M
 fn_parms(){
 parms="nogui"
 }
+
 #### LinuxGSM Settings ####
 
 ## LinuxGSM Stats

+ 1 - 0
lgsm/data/serverlist.csv

@@ -49,6 +49,7 @@ kf2,kf2server,Killing Floor 2
 l4d,l4dserver,Left 4 Dead
 l4d2,l4d2server,Left 4 Dead 2
 mc,mcserver,Minecraft
+mcb,mcbserver,Minecraft Bedrock
 mh,mhserver,MORDHAU
 mohaa,mohaaserver,Medal of Honor: Allied Assault
 mta,mtaserver,Multi Theft Auto

+ 1 - 1
lgsm/functions/command_monitor.sh

@@ -17,7 +17,7 @@ fn_monitor_check_lockfile(){
 		fn_print_checking_eol
 		fn_script_log_info "Checking lockfile: CHECKING"
 		fn_sleep_time
-		fn_print_error_nl "Checking lockfile: No lockfile found: "
+		fn_print_error "Checking lockfile: No lockfile found: "
 		fn_print_error_eol
 		fn_script_log_error "Checking lockfile: No lockfile found: ERROR"
 		fn_sleep_time

+ 2 - 0
lgsm/functions/command_update.sh

@@ -16,6 +16,8 @@ if [ "${shortname}" == "ts3" ]; then
 	update_ts3.sh
 elif [ "${shortname}" == "mc" ]; then
 	update_minecraft.sh
+elif [ "${shortname}" == "mcb" ]; then
+	update_minecraft_bedrock.sh
 elif [ "${shortname}" == "mumble" ]; then
 	update_mumble.sh
 elif [ "${shortname}" == "fctr" ]; then

+ 1 - 1
lgsm/functions/core_dl.sh

@@ -81,7 +81,7 @@ fn_dl_extract(){
 	elif [ "${mime}" == "application/x-xz" ]; then
 		tarcmd=$(tar -xf "${local_filedir}/${local_filename}" -C "${extractdir}")
 	elif [ "${mime}" == "application/zip" ]; then
-		extractcmd=$(unzip -d "${extractdir}" "${local_filedir}/${local_filename}")
+		extractcmd=$(unzip -dq "${extractdir}" "${local_filedir}/${local_filename}")
 	fi
 	local exitcode=$?
 	if [ ${exitcode} -ne 0 ]; then

+ 10 - 0
lgsm/functions/core_functions.sh

@@ -331,6 +331,11 @@ functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
+fix_mcb.sh(){
+functionfile="${FUNCNAME[0]}"
+fn_fetch_function
+}
+
 fix_mta.sh(){
 functionfile="${FUNCNAME[0]}"
 fn_fetch_function
@@ -545,6 +550,11 @@ functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
+update_minecraft_bedrock.sh(){
+functionfile="${FUNCNAME[0]}"
+fn_fetch_function
+}
+
 update_mumble.sh(){
 functionfile="${FUNCNAME[0]}"
 fn_fetch_function

+ 2 - 0
lgsm/functions/fix.sh

@@ -67,6 +67,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th
 		fix_terraria.sh
 	elif [ "${shortname}" == "ts3" ]; then
 		fix_ts3.sh
+	elif [ "${shortname}" == "mcb" ]; then
+		fix_mcb.sh
 	elif [ "${shortname}" == "mta" ]; then
 		fix_mta.sh
 	elif [ "${shortname}" == "unt" ]; then

+ 11 - 0
lgsm/functions/fix_mcb.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+# LinuxGSM fix_mcb.sh function
+# Author: Daniel Gibbs
+# Website: https://linuxgsm.com
+# Description: Resolves possible startup issue with Minecraft Bedrock
+
+local commandname="FIX"
+local commandaction="Fix"
+
+# official docs state that the server should be started with: LD_LIBRARY_PATH=. ./bedrock_server
+export LD_LIBRARY_PATH="${serverfiles}:$LD_LIBRARY_PATH"

+ 32 - 0
lgsm/functions/info_config.sh

@@ -386,6 +386,35 @@ fn_info_config_minecraft(){
 	fi
 }
 
+fn_info_config_minecraft_bedrock(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="${unavailable}"
+		maxplayers="${zero}"
+		port="${zero}"
+		port6="${zero}"
+    queryport="${zero}"
+		gamemode="${unavailable}"
+		gameworld="${unavailable}"
+	else
+		servername=$(grep "server-name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server-name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		maxplayers=$(grep "max-players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+		port=$(grep "server-port\b" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+		port6=$(grep "server-portv6\b" "${servercfgfullpath}" | sed 's/v6//g' | grep -v "#" | tr -cd '[:digit:]')
+    queryport=${port}
+		gamemode=$(grep "gamemode" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		gameworld=$(grep "level-name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/level-name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+
+		# Not Set
+		servername=${servername:-"NOT SET"}
+		maxplayers=${maxplayers:-"NOT SET"}
+		port=${port:-"NOT SET"}
+		port6=${port6:-"NOT SET"}
+    queryport=${queryport:-"NOT SET"}
+		gamemode=${gamemode:-"NOT SET"}
+		gameworld=${gameworld:-"NOT SET"}
+	fi
+}
+
 fn_info_config_mohaa(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		rconpassword="${unavailable}"
@@ -1364,6 +1393,9 @@ elif [ "${shortname}" == "ql" ]; then
 # Minecraft
 elif [ "${shortname}" == "mc" ]; then
 	fn_info_config_minecraft
+# Minecraft Bedrock
+elif [ "${shortname}" == "mcb" ]; then
+	fn_info_config_minecraft_bedrock
 # Post Scriptum: The Bloody Seventh
 elif [ "${shortname}" == "pstbs" ]; then
 	fn_info_config_pstbs

+ 13 - 1
lgsm/functions/info_messages.sh

@@ -541,7 +541,7 @@ fn_info_message_ports(){
 
 	parmslocation="${red}UNKNOWN${default}"
 	# engines/games that require editing in the config file
-	local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "wurm")
+	local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Minecraft Bedrock" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "wurm")
 	for port_edit in "${ports_edit_array[@]}"
 	do
 		if [ "${shortname}" == "ut3" ]; then
@@ -811,6 +811,16 @@ fn_info_message_minecraft(){
 	} | column -s $'\t' -t
 }
 
+fn_info_message_minecraft_bedrock(){
+	echo -e "netstat -atunp | grep bedrock_serv"
+	echo -e ""
+	{
+		echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
+		echo -e "> Game\tINBOUND\t${port}\tudp"
+		echo -e "> Game\tINBOUND\t${port6}\tudp6"
+	} | column -s $'\t' -t
+}
+
 fn_info_message_mohaa(){
 	echo -e "netstat -atunp | grep mohaa_lnxded"
 	echo -e ""
@@ -1368,6 +1378,8 @@ fn_info_message_select_engine(){
 		fn_info_message_justcause3
 	elif [ "${shortname}" == "kf2" ]; then
 		fn_info_message_kf2
+	elif [ "${shortname}" == "mcb" ]; then
+		fn_info_message_minecraft_bedrock
 	elif [ "${shortname}" == "pz" ]; then
 		fn_info_message_projectzomboid
 	elif [ "${shortname}" == "pstbs" ]; then

+ 6 - 0
lgsm/functions/install_config.sh

@@ -440,6 +440,12 @@ elif [ "${shortname}" == "mc" ]; then
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_set_config_vars
+elif [ "${shortname}" == "mcb" ]; then
+	gamedirname="MinecraftBedrock"
+	array_configs+=( server.properties )
+	fn_fetch_default_config
+	fn_default_config_remote
+	fn_set_config_vars
 elif [ "${shortname}" == "mohaa" ]; then
 	gamedirname="MedalOfHonorAlliedAssault"
 	array_configs+=( server.cfg )

+ 2 - 0
lgsm/functions/install_server_files.sh

@@ -153,6 +153,8 @@ if [ "${shortname}" == "ts3" ]; then
 elif [ "${shortname}" == "mc" ]; then
 	install_eula.sh
 	update_minecraft.sh
+elif [ "${shortname}" == "mcb" ]; then
+	update_minecraft_bedrock.sh
 elif [ "${shortname}" == "mumble" ]; then
 	update_mumble.sh
 elif [ "${shortname}" == "mta" ]; then

+ 6 - 3
lgsm/functions/query_gsquery.py

@@ -21,6 +21,7 @@ class gsquery:
         idtech2query=['protocol-quake3','idtech2','quake','iw2.0']
         idtech3query=['protocol-quake3','iw3.0','ioquake3','qfusion']
         minecraftquery=['minecraft','lwjgl2']
+        minecraftbequery=['minecraftbe']
         jc2mpquery=['jc2mp']
         mumblequery=['mumbleping']
         twquery=['teeworlds']
@@ -32,10 +33,12 @@ class gsquery:
             self.query_prompt_string = b'\xff\xff\xff\xffstatus\x00'
         elif self.option.engine in idtech3query:
             self.query_prompt_string = b'\xff\xff\xff\xffgetstatus'
-        elif self.option.engine in minecraftquery:
-            self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93'
         elif self.option.engine in jc2mpquery:
             self.query_prompt_string = b'\xFE\xFD\x09\x10\x20\x30\x40'
+        elif self.option.engine in minecraftquery:
+            self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93'
+        elif self.option.engine in minecraftbequery:
+            self.query_prompt_string = b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78\x00\x00\x00\x00\x00\x00\x00\x00'
         elif self.option.engine in mumblequery:
             self.query_prompt_string = b'\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08'
         elif self.option.engine in unrealquery:
@@ -113,7 +116,7 @@ if __name__ == '__main__':
         action='store',
         dest='engine',
         default=False,
-        help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 minecraft jc2mp mumbleping teeworlds'
+        help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 minecraft minecraftbe jc2mp mumbleping teeworlds'
     )
     parser.add_option(
         '-v', '--verbose',

+ 1 - 1
lgsm/functions/update_minecraft.sh

@@ -64,7 +64,7 @@ fn_update_minecraft_localbuild(){
 	fi
 
 	if [ -z "${localbuild}" ]; then
-		localbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
+		localbuild=$(grep version "${serverfiles}/logs/latest.log" | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
 	fi
 
 	if [ -z "${localbuild}" ]; then

+ 172 - 0
lgsm/functions/update_minecraft_bedrock.sh

@@ -0,0 +1,172 @@
+#!/bin/bash
+# LinuxGSM update_minecraft_bedrock.sh function
+# Author: Daniel Gibbs
+# Website: https://linuxgsm.com
+# Description: Handles updating of Minecraft Bedrock servers.
+
+local commandname="UPDATE"
+local commandaction="Update"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+fn_update_minecraft_dl(){
+	latestmcbuildurl=$(curl -s "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*zip')
+	fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "bedrock_server.${remotebuild}.zip"
+	echo -e "Extracting to ${serverfiles}...\c"
+	if [ "${installer}" == "1" ]; then
+		unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "server.properties" -d "${serverfiles}"
+	else
+		unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "permissions.json" "server.properties" "whitelist.json" -d "${serverfiles}"
+	fi
+	local exitcode=$?
+	if [ "${exitcode}" == "0" ]; then
+		fn_print_ok_eol_nl
+		fn_script_log_pass "Extracting to ${serverfiles}"
+		chmod u+x "${serverfiles}/bedrock_server"
+		fn_clear_tmp
+	else
+		fn_print_fail_eol_nl
+		fn_script_log_fatal "Extracting to ${serverfiles}"
+		core_exit.sh
+	fi
+}
+
+fn_update_minecraft_localbuild(){
+	# Gets local build info.
+	fn_print_dots "Checking for update: ${remotelocation}: checking local build"
+	# Uses log file to gather info.
+	# Log is generated and cleared on startup but filled on shutdown.
+
+	localbuild=$(grep Version $(ls -tr "${consolelogdir}"/* 2>/dev/null) | tail -1 | sed 's/.*Version //')
+
+	if [ -z "${localbuild}" ]; then
+		fn_print_error "Checking for update: ${remotelocation}: checking local build"
+		fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no log files containing version info"
+		fn_script_log_error "No log files containing version info"
+		fn_print_info_nl "Checking for update: ${remotelocation}: checking local build: forcing server restart"
+		fn_script_log_info "Forcing server restart"
+
+		check_status.sh
+		if [ "${status}" != "0" ]; then
+			exitbypass=1
+			command_stop.sh
+		else
+			exitbypass=1
+			command_start.sh
+			sleep 3
+			exitbypass=1
+			command_stop.sh
+		fi
+	fi
+
+	if [ -z "${localbuild}" ]; then
+		localbuild=$(grep Version $(ls -tr "${consolelogdir}"/* 2>/dev/null) | tail -1 | sed 's/.*Version //')
+	fi
+
+	if [ -z "${localbuild}" ]; then
+		localbuild="0"
+		fn_print_error "Checking for update: ${remotelocation}: waiting for local build: missing local build info"
+		fn_script_log_error "Missing local build info"
+		fn_script_log_error "Set localbuild to 0"
+	else
+		fn_print_ok "Checking for update: ${remotelocation}: checking local build"
+		fn_script_log_pass "Checking local build"
+	fi
+}
+
+fn_update_minecraft_remotebuild(){
+	# Gets remote build info.
+	remotebuild=$(curl -s "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*' | sed 's/.*\///' | grep -Eo "[.0-9]+[0-9]")
+	if [ "${installer}" != "1" ]; then
+		fn_print_dots "Checking for update: ${remotelocation}: checking remote build"
+		# Checks if remotebuild variable has been set.
+		if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then
+			fn_print_fail "Checking for update: ${remotelocation}: checking remote build"
+			fn_script_log_fatal "Checking remote build"
+			core_exit.sh
+		else
+			fn_print_ok "Checking for update: ${remotelocation}: checking remote build"
+			fn_script_log_pass "Checking remote build"
+		fi
+	else
+		# Checks if remotebuild variable has been set.
+		if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then
+			fn_print_failure "Unable to get remote build"
+			fn_script_log_fatal "Unable to get remote build"
+			core_exit.sh
+		fi
+	fi
+}
+
+fn_update_minecraft_compare(){
+	# Removes dots so if statement can compare version numbers.
+	fn_print_dots "Checking for update: ${remotelocation}"
+	localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]')
+	remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
+	if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then
+		fn_print_ok_nl "Checking for update: ${remotelocation}"
+		echo -en "\n"
+		echo -e "Update available"
+		echo -e "* Local build: ${red}${localbuild}${default}"
+		echo -e "* Remote build: ${green}${remotebuild}${default}"
+		fn_script_log_info "Update available"
+		fn_script_log_info "Local build: ${localbuild}"
+		fn_script_log_info "Remote build: ${remotebuild}"
+		fn_script_log_info "${localbuild} > ${remotebuild}"
+		fn_sleep_time
+		echo -en "\n"
+		echo -en "applying update.\r"
+		sleep 1
+		echo -en "applying update..\r"
+		sleep 1
+		echo -en "applying update...\r"
+		sleep 1
+		echo -en "\n"
+
+		unset updateonstart
+
+		check_status.sh
+		# If server stopped.
+		if [ "${status}" == "0" ]; then
+			exitbypass=1
+			fn_update_minecraft_dl
+			exitbypass=1
+			command_start.sh
+			exitbypass=1
+			command_stop.sh
+		# If server started.
+		else
+			exitbypass=1
+			command_stop.sh
+			exitbypass=1
+			fn_update_minecraft_dl
+			exitbypass=1
+			command_start.sh
+		fi
+		alert="update"
+		alert.sh
+	else
+		fn_print_ok_nl "Checking for update: ${remotelocation}"
+		echo -en "\n"
+		echo -e "No update available"
+		echo -e "* Local build: ${green}${localbuild}${default}"
+		echo -e "* Remote build: ${green}${remotebuild}${default}"
+		fn_script_log_info "No update available"
+		fn_script_log_info "Local build: ${localbuild}"
+		fn_script_log_info "Remote build: ${remotebuild}"
+	fi
+}
+
+# The location where the builds are checked and downloaded.
+remotelocation="minecraft.net"
+
+if [ "${installer}" == "1" ]; then
+	fn_update_minecraft_remotebuild
+	fn_update_minecraft_dl
+else
+	check_status.sh
+	fn_print_dots "Checking for update: ${remotelocation}"
+	fn_script_log_info "Checking for update: ${remotelocation}"
+	fn_update_minecraft_localbuild
+	fn_update_minecraft_remotebuild
+	fn_update_minecraft_compare
+fi