@@cd /d %~dp0
@echo off
title Game Server Console

:start
@@DEL __wait__ 2>NUL
echo Starting L2J Game Server.
echo.

@@move UPDATE\l2jserver.jar . 2>NUL
@@call L2LogRotate.bat
java -Dtee=log/stdout.log -Djava.util.logging.manager=com.l2jserver.util.L2LogManager -Xms1024m -Xmx1536m -cp ./../libs/*;l2jserver.jar com.l2jserver.gameserver.GameServer

REM NOTE: If you have a powerful machine, you could modify/add some extra parameters for performance, like:
REM -Xms1536m
REM -Xmx3072m
REM -XX:+AggressiveOpts
REM Use this parameters carefully, some of them could cause abnormal behavior, deadlocks, etc.
REM More info here: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

if ERRORLEVEL 2 goto restart
if ERRORLEVEL 1 goto error
goto end

:restart
echo.
echo Admin Restarted Game Server.
echo.
goto start

:error
echo.
echo Game Server Terminated Abnormally!
echo.

:end
@@IF EXIST __wait__ waitServer.bat %0
echo.
echo Game Server Terminated.
echo.
@@IF "%~0" == "%cd%\%~nx0" @PAUSE