def command(thread): print 'Handshake' thread.ProtocolVersion = tuxcraft_tools.minecraft_read_byte(thread.channel) thread.Username = tuxcraft_tools.minecraft_read_string(thread.channel) thread.ServerHost = tuxcraft_tools.minecraft_read_string(thread.channel) thread.ServerPort = tuxcraft_tools.minecraft_read_int(thread.channel) print thread.ProtocolVersion, thread.Username, thread.ServerHost, thread.ServerPort #thread.channel.send( b'\xff' + tuxcraft_tools.minecraft_string(u'Du identifierade dig') ) #time.sleep(5) # The procol docs state that this is necessery due to a bug in the client thread.send( b'\x01' + struct.pack('>i', 1238) + tuxcraft_tools.minecraft_string(u'default') + b'\x00\x00\x00\x00\x08' )
def run(self): print 'New connection: ' , self.details while True: command = self.channel.recv( 1 ) command = struct.unpack('B', command)[0] #print self.details, ' : ' , command if command in tuxcraft_packets.commands: response = tuxcraft_packets.commands[command](self) if response == -1: self.channel.close() break else: self.ticker.removeclient(self) print 'Sending kick!' self.channel.send( b'\xff' + tuxcraft_tools.minecraft_string(u'Unknown command: ' + unicode(command)) ) time.sleep(5) self.channel.close() break
def command(thread): print 'Server list ping' thread.send( b'\xff' + tuxcraft_tools.minecraft_string(u'Tuxies Pythonserver\xa720\xa710') ) time.sleep(5) # The procol docs state that this is necessery due to a bug in the client return -1
def command(thread): print 'Tab completion ' input = tuxcraft_tools.minecraft_read_string(thread.channel) # Message string thread.send(b'\xCB' + tuxcraft_tools.minecraft_string(input))