text stringlengths 0 834k |
|---|
) |
IF NOT %MC_SERVER_IGNORE_OFFLINE% EQU 0 ( |
ECHO Skipping forge server online check... |
ECHO WARN: Skipping forge server online check... 1>> ""%~dp0serverstart.log"" 2>&1 |
GOTO FORGEFILEPREP |
) |
REM Ping minecraftforge before attempting download |
PING -n 2 -w 1000 minecraftforge.net | find ""TTL="" 1>> ""%~dp0serverstart.log"" 2>&1 |
IF %ERRORLEVEL% EQU 0 ( |
ECHO INFO: Ping of ""minecraftforge.net"" Successfull 1>> ""%~dp0serverstart.log"" 2>&1 |
) ELSE ( |
ECHO ERROR: Could not reach minecraftforge.net! Possible firewall or internet issue? |
ECHO ERROR: Could not reach minecraftforge.net 1>> ""%~dp0serverstart.log"" 2>&1 |
SET MC_SERVER_ERROR_REASON=NoInternetConnectivityMinecraftForgeNet |
GOTO ERROR |
) |
:FORGEFILEPREP |
DEL /F /Q ""%~dp0*forge*.html"" 1>> ""%~dp0serverstart.log"" 2>&1 || ECHO INFO: No forge-index to delete 1>> ""%~dp0serverstart.log"" 2>&1 |
DEL /F /Q ""%~dp0*forge*universal*"" 1>> ""%~dp0serverstart.log"" 2>&1 || ECHO INFO: No forge-universal to delete 1>> ""%~dp0serverstart.log"" 2>&1 |
DEL /F /Q ""%~dp0*tmp-forgeinstaller.jar"" 1>> ""%~dp0serverstart.log"" 2>&1 || ECHO INFO: No forge-installer to delete 1>> ""%~dp0serverstart.log"" 2>&1 |
DEL /F /Q ""%~dp0*minecraft*server*%MC_SERVER_MCVER%*.jar"" 1>> ""%~dp0serverstart.log"" 2>&1 || ECHO INFO: No minecraft binary to delete 1>> ""%~dp0serverstart.log"" 2>&1 |
RMDIR /S /Q ""%~dp0libraries"" 1>> ""%~dp0serverstart.log"" 2>&1 || ECHO INFO: No Libraries folder to delete 1>> ""%~dp0serverstart.log"" 2>&1 |
ECHO. |
ECHO. |
ECHO Downloading FORGE (step 1 of 2). This can take several minutes, please be patient... |
REM Check if direct forge URL is specified in config |
IF NOT %MC_SERVER_FORGEURL%==DISABLE ( |
ECHO Attempting to download ""%MC_SERVER_FORGEURL%... this can take a moment, please wait."" |
GOTO DOWNLOADINSTALLER |
) |
SET MC_SERVER_TMP_FLAG=0 |
:FETCHHTML |
REM Download Forge Download Index HTML to parse the URL for the direct download |
ECHO INFO: Fetching index html from forge ^( https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_%MC_SERVER_MCVER%.html ^) 1>> ""%~dp0serverstart.log"" 2>&1 |
bitsadmin /rawreturn /nowrap /transfer dlforgehtml /download /priority FOREGROUND ""https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_%MC_SERVER_MCVER%.html"" ""%~dp0forge-%MC_SERVER_MCVER%.html"" 1>> ""%~dp0serverstart.log"" 2>&1 |
IF NOT EXIST ""%~dp0forge-%MC_SERVER_MCVER%.html"" ( |
IF ""%MC_SERVER_TMP_FLAG%""==""0"" ( |
ECHO Something went wrong, trying again... |
SET MC_SERVER_TMP_FLAG=1 |
GOTO FETCHHTML |
) ELSE ( |
SET MC_SERVER_ERROR_REASON=ForgeIndexNotFound |
GOTO ERROR |
) |
) |
REM Simple search for matching text to make sure we got the correct webpage/html (and not a 404, for example) |
REM ECHO DEBUG: Checking simple pattern match for forge ver to validate HTML... 1>> ""%~dp0serverstart.log"" 2>&1 |
REM FIND /I ""%MC_SERVER_FORGEVER%"" forge-%MC_SERVER_MCVER%.html 1>> ""%~dp0serverstart.log"" 2>&1 || ( |
REM IF %MC_SERVER_TMP_FLAG% LEQ 0 ( |
REM ECHO Something wrong with Forge download part 1 of 2 |
REM ECHO Something wrong with Forge download part 1 of 2 1>> ""%~dp0serverstart.log"" 2>&1 |
REM SET MC_SERVER_TMP_FLAG=1 |
REM DEL /F /Q ""%~dp0*forge-index.html"" 1>> ""%~dp0serverstart.log"" 2>&1 || ECHO INFO: No forge-index to delete 1>> ""%~dp0serverstart.log"" 2>&1 |
REM GOTO FETCHHTML |
REM ) ELSE ( |
REM ECHO HTML Download failed a second time... stopping. |
REM ECHO ERROR: HTML Download failed a second time... stopping. 1>> ""%~dp0serverstart.log"" 2>&1 |
REM SET MC_SERVER_ERROR_REASON=ForgeDownloadURLNotFound |
REM GOTO ERROR |
REM ) |
REM ) |
REM More complex wannabe-regex (aka magic) |
FOR /f tokens^=^5^ delims^=^=^<^>^"" %%G in ('findstr /ir ""http:\/\/files.*%MC_SERVER_FORGEVER%.*installer.jar"" ""%~dp0forge-%MC_SERVER_MCVER%.html""') DO SET MC_SERVER_FORGEURL=%%G & GOTO FETCHHTML1 |
:FETCHHTML1 |
IF ""%MC_SERVER_FORGEURL%""==""%MC_SERVER_FORGEURL:installer.jar=%"" ( |
IF ""%MC_SERVER_TMP_FLAG%""==""0"" ( |
ECHO Something went wrong, trying again... |
SET MC_SERVER_TMP_FLAG=1 |
GOTO FETCHHTML |
) ELSE ( |
SET MC_SERVER_ERROR_REASON=ForgeDownloadURLNotFound |
GOTO ERROR |
) |
) |
ECHO Downloading FORGE (step 2 of 2). This can take several minutes, please be patient... |
SET MC_SERVER_TMP_FLAG=0 |
:DOWNLOADINSTALLER |
REM Attempt to download installer to a temp download |
ECHO DEBUG: Attempting to download ""%MC_SERVER_FORGEURL%"" 1>> ""%~dp0serverstart.log"" 2>&1 |
bitsadmin /rawreturn /nowrap /transfer dlforgeinstaller /download /priority FOREGROUND %MC_SERVER_FORGEURL% ""%~dp0tmp-forgeinstaller.jar"" 1>> ""%~dp0serverstart.log"" 2>&1 |
REM Check that temp-download installer was downloaded |
IF NOT EXIST ""%~dp0tmp-forgeinstaller.jar"" ( |
IF ""%MC_SERVER_TMP_FLAG%""==""0"" ( |
ECHO Something wrong with download 2 of 2 - FORGE installer, trying again... |
ECHO Something wrong with download 2 of 2 - FORGE installer, trying again... 1>> ""%~dp0serverstart.log"" 2>&1 |
SET MC_SERVER_TMP_FLAG=1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.