示例#1
0
 def send_chat(self, message, sender=UUID(int=0)):
     for player in self.players:
         data = player.buff_type.pack_chat(message) + player.buff_type.pack(
             "B", 0)
         if player.protocol_version > 578:
             data += player.buff_type.pack_uuid(sender)
         player.send_packet("chat_message", data)
示例#2
0
	def buildProtocol(self, addr):
		# Build protocol with an unassigned uuid
		try:
			k = [*self.uuid_dict.keys()][[*self.uuid_dict.values()].index(None)]
			pc = InternalProxyExternalProtocol(self, self.buff_class, self.handle_direction, self.other_factory, self.config)
			pc.uuid = UUID(hex=k)
			return pc
		except ValueError:
			pass
示例#3
0
    def send_chat(self, message, sender=None):
        if sender is None:
            sender = UUID(int=0)

        for player in self.players:
            player.send_packet("chat_message",
                               player.buff_type.pack_chat(message),
                               player.buff_type.pack('B', 0),
                               player.buff_type.pack_uuid(sender))
示例#4
0
    def send_chat(self, message, sender=None):
        if sender is None:
            sender = UUID(int=0)

        self.send_packet(
            "chat_message",
            self.buff_type.pack_chat(message),
            self.buff_type.pack('b', 1),
            self.buff_type.pack_uuid(sender)
        )
示例#5
0
 def buildProtocol(self, addr):
     # Build protocol with an unassigned uuid
     try:
         k = [*self.uuid_dict.keys()][[*self.uuid_dict.values()
                                       ].index(None)]
         return InternalProxyMCClientProtocol(self,
                                              self.buff_class,
                                              self.handle_direction,
                                              self.other_factory,
                                              self.protocol_version,
                                              uuid=UUID(hex=k))
     except ValueError:
         pass
示例#6
0
    def write_chat(self, text, direction):
        if direction == "upstream":
            return self.buff_type.pack_string(text)
        elif direction == "downstream":
            data = self.buff_type.pack_chat(text)

            # 1.8.x+
            if self.downstream.protocol_version >= 47:
                data += self.buff_type.pack('B', 0)

            # 1.16.x+
            if self.downstream.protocol_version >= 736:
                data += self.buff_type.pack_uuid(UUID(int=0))

            return data
示例#7
0
 def send_chat_message(self, message):
     self.protocol.send_packet(
         'chat_message', self.protocol.buff_type.pack_string(message),
         self.protocol.buff_type.pack("b", 1),
         self.protocol.buff_type.pack_uuid(UUID(int=0)))