-
Notifications
You must be signed in to change notification settings - Fork 2
/
AvrixLauncher-Server-Dedicated-Steam.bat
82 lines (67 loc) · 3.39 KB
/
AvrixLauncher-Server-Dedicated-Steam.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
@echo off
chcp 65001 > nul
setlocal enabledelayedexpansion
cd /d "%~dp0"
echo ======================= Avrix Launcher =======================
rem Defining the OS architecture
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set "osArchitecture=x86" || set "osArchitecture=x64"
rem Check if Java is in PATH
java -version >nul 2>&1
rem Check JDK
if %errorlevel% neq 0 (
echo [Avrix-Launcher] Java is not found in PATH. Please install JDK 17 or higher and add it to the PATH.
echo [Avrix-Launcher] Download link: https://www.oracle.com/java/technologies/downloads/.
pause
exit /b
)
for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do set "jdkVersion=%%j.%%k.%%l-%%m"
if not defined jdkVersion (
echo [Avrix-Launcher] Failed to determine Java version.
echo [Avrix-Launcher] Check if JDK17+ is installed and the path is correct in the System PATH.
pause
exit /b
)
if %jdkVersion% lss 17 (
echo [Avrix-Launcher] Java 17 or higher is required. Current version is %jdkVersion%.
echo [Avrix-Launcher] Download link: https://www.oracle.com/java/technologies/downloads/.
pause
exit /b
)
rem Setting up variables
set "classPath=java/;java/istack-commons-runtime.jar;java/jassimp.jar;java/javacord-2.0.17-shaded.jar;java/javax.activation-api.jar;java/jaxb-api.jar;java/jaxb-runtime.jar;java/lwjgl.jar;java/lwjgl-glfw.jar;java/lwjgl-jemalloc.jar;java/lwjgl-opengl.jar;java/lwjgl_util.jar;java/sqlite-jdbc-3.27.2.1.jar;java/trove-3.0.3.jar;java/uncommons-maths-1.2.3.jar;java/commons-compress-1.18.jar;"
if "%osArchitecture%"=="x64" (
set "libraryPath=natives/;natives/win64/;."
set "javaOptions=-XX:+UseZGC -Xmx16g"
set "classPath=!classPath!java/lwjgl-natives-windows.jar;java/lwjgl-glfw-natives-windows.jar;java/lwjgl-jemalloc-natives-windows.jar;java/lwjgl-opengl-natives-windows.jar;"
) else (
set "libraryPath=natives/;natives/win32/;./"
set "javaOptions=-XX:+UseG1GC -Xmx1200m"
set "classPath=!classPath!java/lwjgl-natives-windows-x86.jar;java/lwjgl-glfw-natives-windows-x86.jar;java/lwjgl-jemalloc-natives-windows-x86.jar;java/lwjgl-opengl-natives-windows-x86.jar;"
)
:checkingFolders
rem Check the availability of the necessary folders
echo [Avrix-Launcher] Checking the server directory...
if not exist "java" goto serverNotFound
if not exist "natives" goto serverNotFound
if not exist "java\zombie" goto serverNotFound
if not exist "java\se" goto serverNotFound
if not exist "java\fmod" goto serverNotFound
echo [Avrix-Launcher] The server directory has been confirmed.
goto launchApp
:serverNotFound
echo [Avrix-Launcher] The necessary folders were not found!
echo [Avrix-Launcher] Move core jar file and this script to the root folder of your server and try again.
pause
exit /b
rem Launching the application
:launchApp
for %%f in (./Avrix-Core-*.jar) do set "jarFile=%%~nf" & set "classPath=!classPath!%%f"
if "%jarFile%"=="" (
echo [Avrix-Launcher] The wrapper Jar file was not found! Place it next to the launcher!
pause
exit /b
)
set "javaArg=-Djava.awt.headless=true -Davrix.mode=server -Dzomboid.steam=1 -Dzomboid.znetlog=1 %javaOptions% -Djava.library.path=%libraryPath% -cp %classPath%"
echo [Avrix-Launcher] Core: %jarFile% ^| OS: Win %osArchitecture% ^| JDK: %jdkVersion% ^| Steam mode: yes
java -Djdk.attach.allowAttachSelf=true -XX:+EnableDynamicAgentLoading %javaArg% com.avrix.Launcher %1 %2
pause