def server_stop(self, e): e.handled = True if self.protocol is None or not self.protocol.alive: if e.respawn == events.ServerStop.TERMINATE: print "I'm stopping the reactor now! Reason: %s" % e.reason reactor.stop() return else: self.parent.console("server is not running") return if e.announce: yield self.parent.events.dispatch( events.ServerStopping(respawn=e.respawn, reason=e.reason, kill=e.kill)) if self.failsafe and self.failsafe.active(): self.failsafe.cancel() self.failsafe = None if e.kill: self.failsafe = None self.parent.console("killing %s (caused by %s)" % (self.parent.server_name, e.reason)) self.transport.signalProcess('KILL') else: self.parent.console("stopping %s (caused by %s)" % (self.parent.server_name, e.reason)) self.transport.write(self.stop_cmd) self.failsafe = self.parent.events.dispatch_delayed( events.ServerStop(respawn=e.respawn, reason=e.reason, kill=True, announce=False), self.parent.config['mark2.shutdown_timeout'])
def server_stop(self, e): e.handled = True if self.protocol is None or not self.protocol.alive: return if e.announce: yield self.parent.events.dispatch(events.ServerStopping(respawn=e.respawn, reason=e.reason, kill=e.kill)) if e.kill: self.failsafe = None self.parent.console("killing minecraft server") self.transport.signalProcess('KILL') else: self.parent.console("stopping minecraft server") self.transport.write(self.stop_cmd) self.failsafe = self.parent.events.dispatch_delayed(events.ServerStop(respawn=e.respawn, reason=e.reason, kill=True, announce=False), self.parent.config['mark2.shutdown_timeout'])