Skip to content

Commit 77ae82d

Browse files
committed
🤏 Reduced file size slightly
Refactored how the config file was called to be a variable to reduce amount of characters stored.
1 parent 7c380c4 commit 77ae82d

File tree

1 file changed

+42
-41
lines changed

1 file changed

+42
-41
lines changed

START.bat

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title Checking dependencies...
33
set scriptVersion=v1.3.1
44
set currentConfigVersion=v1.3.0
5+
set "configFile=.\config\StartupScript.conf"
56

67
REM Set restart counter variables
78
set "restartCount=0"
@@ -14,12 +15,12 @@ if not exist "config" (
1415
)
1516

1617
REM Check if script config file exists, if not, go to create it.
17-
if not exist .\config\StartupScript.conf (
18+
if not exist %configFile% (
1819
goto initialSetup
1920
) else (
2021
REM Check configuration version
2122
set "configVersion="
22-
for /f "tokens=1,* delims==" %%a in ('type .\config\StartupScript.conf') do (
23+
for /f "tokens=1,* delims==" %%a in ('type %configFile%') do (
2324
if "%%a"=="configVersion" (
2425
set "configVersion=%%b"
2526
goto configVersionFound
@@ -76,7 +77,7 @@ if not exist "eula.txt" (
7677
)
7778

7879
REM Reads the startup config file and fetches the variables from the config file and ignores "#" comments
79-
for /f "tokens=*" %%i in ('type .\config\StartupScript.conf ^| findstr /V "^#"') do (
80+
for /f "tokens=*" %%i in ('type %configFile% ^| findstr /V "^#"') do (
8081
for /f "tokens=1,2 delims==" %%a in ("%%i") do (
8182
set "%%a=%%b"
8283
)
@@ -262,44 +263,44 @@ if %errorlevel%==2 goto initialSetup
262263

263264
:saveSetup
264265
title Saving setup...
265-
echo # Configuration File Version > .\config\StartupScript.conf
266-
echo configVersion=%currentConfigVersion%>> .\config\StartupScript.conf
267-
echo # >> .\config\StartupScript.conf
268-
echo # --------------------------------------------------------------------------------------------------------------------------- >> .\config\StartupScript.conf
269-
echo # General Server Options >> .\config\StartupScript.conf
270-
echo # --------------------------------------------------------------------------------------------------------------------------- >> .\config\StartupScript.conf
271-
echo # >> .\config\StartupScript.conf
272-
echo # Define server file name here >> .\config\StartupScript.conf
273-
echo serverName=%serverName%>> .\config\StartupScript.conf
274-
echo. >> .\config\StartupScript.conf
275-
echo # Define RAM allocation amount here you can use G for Gigabytes or M for Megabytes >> .\config\StartupScript.conf
276-
echo # Maximum memory allocation pool >> .\config\StartupScript.conf
277-
echo maxRam=%maxRam%>> .\config\StartupScript.conf
278-
echo # Initial memory allocation pool >> .\config\StartupScript.conf
279-
echo iniRam=%iniRam%>> .\config\StartupScript.conf
280-
echo. >> .\config\StartupScript.conf
281-
echo # Restart mode on crash or /restart ^(true/false^) default = true >> .\config\StartupScript.conf
282-
echo autoRestart=%autoRestart%>> .\config\StartupScript.conf
283-
echo. >> .\config\StartupScript.conf
284-
echo # Vanilla server GUI ^(true/false^) >> .\config\StartupScript.conf
285-
echo GUI=%GUI%>> .\config\StartupScript.conf
286-
echo. >> .\config\StartupScript.conf
287-
echo # Set console title here >> .\config\StartupScript.conf
288-
echo Title=Minecraft Server >> .\config\StartupScript.conf
289-
echo. >> .\config\StartupScript.conf
290-
echo # --------------------------------------------------------------------------------------------------------------------------- >> .\config\StartupScript.conf
291-
echo # Discord Webhook Options >> .\config\StartupScript.conf
292-
echo # --------------------------------------------------------------------------------------------------------------------------- >> .\config\StartupScript.conf
293-
echo # Follow the "Making a Webhook" section here: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks>> .\config\StartupScript.conf
294-
echo. >> .\config\StartupScript.conf
295-
echo # Set the Discord webhook URL here >> .\config\StartupScript.conf
296-
echo webhookURL=%webhookURL%>> .\config\StartupScript.conf
297-
echo. >> .\config\StartupScript.conf
298-
echo # Set the message which is sent via webhook when the server stops >> .\config\StartupScript.conf
299-
echo webhookMessageStop=```\uD83C\uDFC1 The server has stopped.```>> .\config\StartupScript.conf
300-
echo. >> .\config\StartupScript.conf
301-
echo # Set the message which is sent via webhook when the server stops >> .\config\StartupScript.conf
302-
echo webhookMessageStart=```\uD83D\uDE80 The server has started.```>> .\config\StartupScript.conf
266+
echo # Configuration File Version > %configFile%
267+
echo configVersion=%currentConfigVersion%>> %configFile%
268+
echo # >> %configFile%
269+
echo # --------------------------------------------------------------------------------------------------------------------------- >> %configFile%
270+
echo # General Server Options >> %configFile%
271+
echo # --------------------------------------------------------------------------------------------------------------------------- >> %configFile%
272+
echo # >> %configFile%
273+
echo # Define server file name here >> %configFile%
274+
echo serverName=%serverName%>> %configFile%
275+
echo. >> %configFile%
276+
echo # Define RAM allocation amount here you can use G for Gigabytes or M for Megabytes >> %configFile%
277+
echo # Maximum memory allocation pool >> %configFile%
278+
echo maxRam=%maxRam%>> %configFile%
279+
echo # Initial memory allocation pool >> %configFile%
280+
echo iniRam=%iniRam%>> %configFile%
281+
echo. >> %configFile%
282+
echo # Restart mode on crash or /restart ^(true/false^) default = true >> %configFile%
283+
echo autoRestart=%autoRestart%>> %configFile%
284+
echo. >> %configFile%
285+
echo # Vanilla server GUI ^(true/false^) >> %configFile%
286+
echo GUI=%GUI%>> %configFile%
287+
echo. >> %configFile%
288+
echo # Set console title here >> %configFile%
289+
echo Title=Minecraft Server >> %configFile%
290+
echo. >> %configFile%
291+
echo # --------------------------------------------------------------------------------------------------------------------------- >> %configFile%
292+
echo # Discord Webhook Options >> %configFile%
293+
echo # --------------------------------------------------------------------------------------------------------------------------- >> %configFile%
294+
echo # Follow the "Making a Webhook" section here: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks>> %configFile%
295+
echo. >> %configFile%
296+
echo # Set the Discord webhook URL here >> %configFile%
297+
echo webhookURL=%webhookURL%>> %configFile%
298+
echo. >> %configFile%
299+
echo # Set the message which is sent via webhook when the server stops >> %configFile%
300+
echo webhookMessageStop=```\uD83C\uDFC1 The server has stopped.```>> %configFile%
301+
echo. >> %configFile%
302+
echo # Set the message which is sent via webhook when the server stops >> %configFile%
303+
echo webhookMessageStart=```\uD83D\uDE80 The server has started.```>> %configFile%
303304
echo Config variables successfully saved to StartupScript.conf
304305

305306
REM Write Java Args to .\config\jvm_args.txt

0 commit comments

Comments
 (0)