-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartserver-template-18.bat
66 lines (56 loc) · 1.99 KB
/
startserver-template-18.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@echo off
set FORGE_VERSION=@version@
:: To use a specific Java runtime, set an environment variable named ATM7_JAVA to the full path of java.exe.
:: To disable automatic restarts, set an environment variable named ATM7_RESTART to false.
:: To install the pack without starting the server, set an environment variable named ATM7_INSTALL_ONLY to true.
set MIRROR=https://maven.allthehosting.com/releases/
:: If the ATM mirror goes down, uncomment this to use the Forge maven instead.
:: set MIRROR=https://maven.minecraftforge.net/
set INSTALLER="%~dp0forge-1.18.2-%FORGE_VERSION%-installer.jar"
set FORGE_URL="%MIRROR%net/minecraftforge/forge/1.18.2-%FORGE_VERSION%/forge-1.18.2-%FORGE_VERSION%-installer.jar"
:JAVA
if not defined ATM7_JAVA (
set ATM7_JAVA=java
)
"%ATM7_JAVA%" -version 1>nul 2>nul || (
echo Minecraft 1.18 requires Java 17 - Java not found
pause
exit /b 1
)
:FORGE
setlocal
cd /D "%~dp0"
if not exist "libraries" (
echo Forge not installed, installing now.
if not exist %INSTALLER% (
echo No Forge installer found, downloading from %FORGE_URL%
powershell -Command "Invoke-WebRequest %FORGE_URL% -OutFile %INSTALLER%"
)
echo Running Forge installer.
"%ATM7_JAVA%" -jar %INSTALLER% -installServer -mirror %MIRROR%
)
if not exist "server.properties" (
(
echo allow-flight=true
echo motd=All the Mods 7
echo max-tick-time=180000
)> "server.properties"
)
if "%ATM7_INSTALL_ONLY%" == "true" (
echo INSTALL_ONLY: complete
goto:EOF
)
for /f tokens^=2-5^ delims^=.-_^" %%j in ('"%ATM7_JAVA%" -fullversion 2^>^&1') do set "jver=%%j"
if not %jver% geq 17 (
echo Minecraft 1.18 requires Java 17 - found Java %jver%
pause
exit /b 1
)
:START
"%ATM7_JAVA%" @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.18.2-%FORGE_VERSION%/win_args.txt nogui
if "%ATM7_RESTART%" == "false" (
goto:EOF
)
echo Restarting automatically in 10 seconds (press Ctrl + C to cancel)
timeout /t 10 /nobreak > NUL
goto:START