26 lines
417 B
Python
26 lines
417 B
Python
import time
|
|
|
|
from mcrcon import MCRcon
|
|
|
|
IP = '127.0.0.1'
|
|
PASS = 'jean-qot'
|
|
|
|
empty_count = 0
|
|
|
|
def check_empty():
|
|
with MCRcon(IP, PASS) as mcr:
|
|
resp = mcr.command('/list')
|
|
return 'There are 0 of a max' in resp
|
|
|
|
while True:
|
|
if check_empty():
|
|
empty_count += 1
|
|
else:
|
|
empty_count = 0
|
|
|
|
if empty_count >= 15:
|
|
print('shutdown server!')
|
|
break
|
|
|
|
time.sleep(60)
|