Ra7eN

2023 Minecraft RESTARTER with auto server.jar version check

Jan 1st, 2023 (edited)
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.35 KB | Gaming | 0 0
  1. @echo off
  2. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3. :: :::: S T A R T S E R V E R . B A T                    ::::
  4. :: :::: CONTACT INFO: RSCORPIO64@GMAIL.COM               ::::
  5. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6.  
  7. title Minecraft Server Starter
  8.  
  9. :: NEED ABSOLUTE PATH TO MINECRAFT SERVER
  10. c:
  11. cd "\mcserver\"
  12.  
  13. :: LOAD UP THE BATCH FILE
  14. :: start /min "SERVER_BACKUP" backup.bat
  15.  
  16. :LOAD_SERVER
  17. cls
  18. echo.
  19.  
  20. echo "   _____            ___________________    _____ _____________________"
  21. echo "  /     \           \_   ___ \______   \  /  _  \\_   _____|__    ___/"
  22. echo " /  \ /  \   ______ /    \  \/|       _/ /  /_\  \|    __)   |    |   "
  23. echo "/    Y    \ /_____/ \     \___|    |   \/    |    \     \    |    |   "
  24. echo "\____|__  /          \______  /____|_  /\____|__  |___  /    |____|   "
  25. echo "        \/                  \/       \/         \/    \/              "
  26. echo "  ________________________________   _______________________          "
  27. echo " /   _____|_   _____|______   \   \ /   |_   _____|______   \         "
  28. echo " \_____  \ |    __)_ |       _/\   Y   / |    __)_ |       _/         "
  29. echo " /        \|        \|    |   \ \     /  |        \|    |   \         "
  30. echo "/_______  /_______  /|____|_  /  \___/  /_______  /|____|_  /         "
  31. echo "        \/        \/        \/                  \/        \/          "
  32. echo "__________ ____ __________    _______  .___ _______    ________       "
  33. echo "\______   \    |   \      \   \      \ |   |\      \  /  _____/       "
  34. echo " |       _/    |   /   |   \  /   |   \|   |/   |   \/   \  ___       "
  35. echo " |    |   \    |  /    |    \/    |    \   /    |    \    \_\  \      "
  36. echo " |____|_  /______/\____|__  /\____|__  /___\____|__  /\______  /      "
  37. echo.
  38.  
  39. :: next line optional for title display
  40. timeout /t 2
  41.  
  42. :: GET LATEST SERVER ON EACH LOAD
  43. del server.jar /Q
  44. :: CURL manditory to work
  45. :: https://www.mediafire.com/file/a2tpm3u28k233qt/curl-7.64.1.7z/file
  46. echo.
  47. echo Checking for latest MINECRAFT version
  48. echo ------------------------------------------
  49. curl -O https://piston-data.mojang.com/v1/objects/c9df48efed58511cdd0213c56b9013a7b5c9ac1f/server.jar
  50. echo.
  51. echo.
  52. echo.
  53. echo STARTING SERVER
  54. echo.
  55. echo.
  56. :: LOAD YOUR SERVER HERE
  57. :: ## CHANGE MEMORY REQUIREMENTS HERE AS DESIRED
  58.  
  59. start /b /wait "MINECRAFT RESTARTER" java.exe -Xmx4G -Xms4G -jar server.jar nogui
  60. echo.
  61.  
  62. :: SYSTEM COMES HERE WHEN THE SERVER STOPS
  63. :: WHAT WE DO HERE IS DO A TIME OUT INCASE THE EXIT WAS INTENTIONAL,
  64. :: IF NOT IT WILL BE TREATED AS A CRASH
  65. :: ALLOW 10 SECOND DELAY,
  66. echo Server stoppped!! Server will reload in 10 seconds,
  67. echo PRESS ANY KEY TO EXIT SERVER
  68. call :controlTimeout 15
  69. if errorlevel 1 (
  70.     GOTO EXIT_SERVER
  71. ) else (
  72.     GOTO CRASH
  73. )
  74. exit /b
  75.  
  76. :controlTimeout
  77. :: TIMEOUT IS A BUILT IN WINDOWS FEATURE
  78. setlocal
  79. start "" /belownormal /b cmd /q /d /c "timeout.exe %~1 /nobreak > nul"
  80. timeout.exe %~1 & tasklist | find "timeout" >nul
  81. if errorlevel 1 ( set "exitCode=0" ) else (
  82.     set "exitCode=1"
  83.     taskkill /f /im timeout.exe 2>nul >nul
  84. )
  85. endlocal & exit /b %exitCode%
  86.  
  87. :CRASH
  88. :: ADD TO LOG HERE IF CTRL-X WAS NOT PRESED
  89. set this_date = date /t
  90. echo Server Crashed on !this_date! >> crash.log
  91.  
  92. :: IF NOT, IT MUST HAVE BEEN A CRASH, RELOAD THE SERVER
  93. GOTO LOAD_SERVER
  94.  
  95. :EXIT_SERVER
  96. del /q server.up
  97. exit 0
Add Comment
Please, Sign In to add comment