def packet_handshake(self, buff): buff2 = deepcopy(buff) super().packet_handshake(buff) p_protocol_version = buff2.unpack_varint() p_connect_host = buff2.unpack_string() # Bungeecord ip forwarding, ip/uuid is included in host string separated by \00s split_host = str.split(p_connect_host, "\00") if len(split_host) >= 3: # TODO: Should probably verify the encrypted data in some way. # Not important until something on this server uses uuids if split_host[1] == 'Geyser-Floodgate': self.is_bedrock = True host = split_host[4] online_uuid = split_host[5] elif split_host[1].startswith('^Floodgate^'): self.is_bedrock = True host = split_host[2] online_uuid = split_host[3] else: host = split_host[1] online_uuid = split_host[2] self.forwarded_host = host self.forwarded_uuid = UUID.from_hex(online_uuid) version = None for pv, v in self.versions.items(): if p_protocol_version >= pv: version = v if version is not None: self.version = version(self, self.is_bedrock) else: self.close("Unsupported Minecraft Version")
def generate_uuid(self): return QuarryUUID.from_hex(py_uuid.uuid4().hex)
def test_uuid_from_hex_to_byte(): uuid = UUID.from_hex(hex_vector) assert isinstance(uuid, UUID) assert uuid.to_bytes() == bytes_vector
def auth_ok(self, data): """Called when auth with mojang succeeded (online mode only)""" self.display_name_confirmed = True self.uuid = UUID.from_hex(data['id']) self.player_joined()
def _from_response(cls, response): return cls(response['clientToken'], response['accessToken'], response['selectedProfile']['name'], UUID.from_hex(response['selectedProfile']['id']))
def from_token(cls, client_token, access_token, display_name, uuid): obj = cls(client_token, access_token, display_name, UUID.from_hex(uuid)) return obj.validate()
def packet_mirror_login_success(self, buff): self.player_uuid = UUID.from_hex(buff.unpack_string()) self.player_username = buff.unpack_string() return
def _from_response(cls, response): return cls( response['clientToken'], response['accessToken'], response['selectedProfile']['name'], UUID.from_hex(response['selectedProfile']['id']))