Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/BeaconMCDev/BeaconMC
Browse files Browse the repository at this point in the history
  • Loading branch information
FewerElk committed Sep 6, 2024
2 parents c15469c + 63ec265 commit 3572d4d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,9 @@ def __repr__(self) -> bytes:
...
# elif isinstance(i, bytes):
# out += i
elif isinstance(i, str):
out += self.pack_varint(len(i))
out += bytes(i, "utf-8")
else:
out += self.pack_data(i)
out = self.pack_varint(len(out)) + out
Expand Down Expand Up @@ -837,6 +840,11 @@ def client_thread(self, id):
log(f"{traceback.format_exc()}", 2)
self.connected = False
dp = Packet(self.connexion, "-OUTGOING", typep=27, args=('{"text":"Internal server error"}', ))
dp.send()
self.connexion.close()
if self in self.server.list_clients:
self.server.list_clients.remove(self)
del(self)

def ping_response(self, payload):
"""Send a response to a ping to make the client get the ping in ms of the server."""
Expand Down

0 comments on commit 3572d4d

Please sign in to comment.