Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom Minecraft server script with banned until date and IP address
@echo off
REM Start server script that won't start before a certain date and gives the IP address
REM current date
for /f "tokens=1-3 delims=/ " %%a in ('date /t') do (set olddate=%%a-%%b-%%c)
REM The server will run on or after this date
set newdate=02-08-2014
set "sdate1=%olddate:~-4%%olddate:~3,2%%olddate:~0,2%"
set "sdate2=%newdate:~-4%%newdate:~3,2%%newdate:~0,2%"
if %sdate2% GTR %sdate1% goto NaughtyRavi
:StartServer
REM Get the IP address of the local server
set ip_address_string="IPv4 Address"
for /f "usebackq tokens=2 delims=:" %%f in (`ipconfig ^| findstr /c:%ip_address_string%`) do echo Server: %%f
"C:\Program Files (x86)\Java\jre7\bin\java.exe" -Xms1024M -Xmx1024M -jar minecraft_server.1.7.9.jar
goto End
:NaughtyRavi
echo Ravi is naughty
:End
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment