This commit is contained in:
əlemi 2022-04-18 20:32:00 +02:00
parent 5a68b8bb4e
commit 2030bfc97b
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E
2 changed files with 6 additions and 4 deletions

View file

@ -59,6 +59,8 @@ class Dispatcher:
self.host = "localhost"
self.port = 25565
self._dispatching = False
self._packet_whitelist = None
self._packet_id_whitelist = None
@property
def is_server(self) -> bool:
@ -113,8 +115,8 @@ class Dispatcher:
def set_proto(self, proto:Optional[int]=757) -> 'Dispatcher':
self.proto = proto or self.proto
if self._packet_id_whitelist:
self._packet_id_whitelist = set((P(self.proto).id for P in self._packet_whitelist)) if self._packet_whitelist else set()
if self._packet_whitelist:
self._packet_id_whitelist = set((P(self.proto).id for P in self._packet_whitelist))
return self
def set_state(self, state:Optional[ConnectionState]=ConnectionState.HANDSHAKING) -> 'Dispatcher':

View file

@ -79,7 +79,7 @@ class MicrosoftAuthenticator(AuthInterface):
async def refresh(self):
if not self.refreshToken:
raise AuthException("Missing refresh token")
raise AuthException("refresh", 404, {"error": "Missing refresh token"}, {})
self.accessToken = await self.authenticate()
prof = await self.fetch_profile()
self.selectedProfile = GameProfile(id=prof['id'], name=prof['name'])
@ -87,7 +87,7 @@ class MicrosoftAuthenticator(AuthInterface):
async def validate(self):
if not self.accessToken:
raise AuthException("No access token")
raise AuthException("validate", 404, {"error": "No access token"}, {})
prof = await self.fetch_profile()
self.selectedProfile = GameProfile(id=prof['id'], name=prof['name'])
logging.info("Session validated : %s", repr(self.selectedProfile))