예제 #1
0
파일: service.py 프로젝트: pubbot/minecraft
    def _really_start(self):
        self.session = Session()
        yield self.session.login(self.username, self.password)
 
        self.factory = MinecraftClientFactory(self.username, self.password, self.session)
        self.client = internet.TCPClient(self.host, self.port, self.factory)
        self.client.setServiceParent(self)
예제 #2
0
파일: service.py 프로젝트: pubbot/minecraft
class MinecraftClientService(service.MultiService):

    LAUNCHER_VERSION = 13

    def __init__(self, username, password, host="localhost", port=25565):
        self.username = username
        self.password = password
        self.host = host
        self.port = port
        self.session = None
        service.MultiService.__init__(self)

    def startService(self):
        self._really_start()
        service.MultiService.startService(self)

    def stopService(self):
        service.MultiService.stopService(self)

    @defer.inlineCallbacks
    def _really_start(self):
        self.session = Session()
        yield self.session.login(self.username, self.password)
 
        self.factory = MinecraftClientFactory(self.username, self.password, self.session)
        self.client = internet.TCPClient(self.host, self.port, self.factory)
        self.client.setServiceParent(self)