You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
417 B
26 lines
417 B
5 years ago
|
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)
|