#!/usr/bin/env python3 import time import sys import datetime from mcrcon import MCRcon from CONFIG import HOST,PW,PORT autosave_on=False with MCRcon(HOST, PW, port=PORT) as mcr: current_time = datetime.datetime.now().strftime("%H:%M") resp = mcr.command("say {}: Server will restart in §a10§f minutes".format(current_time)) time.sleep(300) current_time = datetime.datetime.now().strftime("%H:%M") resp = mcr.command("say {}: Server will restart in §e5§f minutes".format(current_time)) time.sleep(240) current_time = datetime.datetime.now().strftime("%H:%M") resp = mcr.command("say {}: Server will restart in §61§f minute".format(current_time)) time.sleep(50) for i in range(10): resp = mcr.command("say Server will restart in §4{}§f seconds".format(10-i)) time.sleep(1) resp = mcr.command("restart") sys.exit(0)