bugfix: Fixed not being able to send messages on legacy versions (1.4.6 - 1.6.4)

bugfix: Fixed not being able to send messages on legacy versions (1.4.6 - 1.6.4)
This commit is contained in:
Anon 2026-06-06 14:14:52 +02:00 committed by GitHub
commit 80c07634e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -132,6 +132,7 @@ namespace MinecraftClient.Protocol.Handlers
byte[] keepalive = new byte[5] { 0, 0, 0, 0, 0 };
Receive(keepalive, 1, 4, SocketFlags.None);
handler.OnServerKeepAlive();
handler.SetCanSendMessage(true);
Send(keepalive); break;
case 0x01: ReadData(4); ReadNextString(); ReadData(5); break;
case 0x02: ReadData(1); ReadNextString(); ReadNextString(); ReadData(4); break;
@ -208,7 +209,8 @@ namespace MinecraftClient.Protocol.Handlers
case 0xC9:
string name = ReadNextString(); bool online = ReadNextByte() != 0x00; ReadData(2);
Guid FakeUUID = new(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(name)).Take(16).ToArray());
if (online) { handler.OnPlayerJoin(new PlayerInfo(name, FakeUUID)); } else { handler.OnPlayerLeave(FakeUUID); }
if (online) handler.OnPlayerJoin(new PlayerInfo(name, FakeUUID));
else handler.OnPlayerLeave(FakeUUID);
break;
case 0xCA: if (protocolversion >= 72) { ReadData(9); } else ReadData(3); break;
case 0xCB: