forked from zkingboos/mc-dripcraft-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
startserver.bat
50 lines (39 loc) · 1.06 KB
/
startserver.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
@ECHO OFF
SETLOCAL
:BEGIN
CLS
COLOR 3F >nul 2>&1
SET MC_SYS32=%SYSTEMROOT%\SYSTEM32
REM Make batch directory the same as the directory it's being called from
REM For example, if "run as admin" the batch starting dir could be system32
CD "%~dp0" >nul 2>&1
:CHECKJAVA
ECHO INFO: Checking java installation...
ECHO.
REM If no Java is installed this line will catch it simply
java -version >nul 2>&1
ECHO.
IF %ERRORLEVEL% EQU 0 (
ECHO INFO: Found Java.
GOTO CHECK
) ELSE (
GOTO JAVAERROR
)
:MAIN
java -jar serverstarter-2.0.1.jar
GOTO EOF
:CHECK
REM Check if serverstarter JAR is already downloaded
IF NOT EXIST "%cd%\serverstarter-2.0.1.jar" (
ECHO serverstarter binary not found, downloading serverstarter...
%SYSTEMROOT%\SYSTEM32\bitsadmin.exe /rawreturn /nowrap /transfer starter /dynamic /download /priority foreground https://github.com/AllTheMods/alltheservers/releases/download/2.0.1/serverstarter-2.0.1.jar "%cd%\serverstarter-2.0.1.jar"
GOTO MAIN
) ELSE (
GOTO MAIN
)
:JAVAERROR
COLOR CF
ECHO ERROR: Could not find Java installed or in PATH
PAUSE
:EOF
pause