From bcded404760e5fcfd219e494ec94897a28387fa0 Mon Sep 17 00:00:00 2001 From: BruceChen Date: Sun, 4 Sep 2022 10:50:49 +0800 Subject: [PATCH] Bug fix --- MinecraftClient/Protocol/Handlers/Protocol16.cs | 2 +- MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol16.cs b/MinecraftClient/Protocol/Handlers/Protocol16.cs index 602b1b8d..b0ff6546 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol16.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol16.cs @@ -582,7 +582,7 @@ namespace MinecraftClient.Protocol.Handlers public bool Login(PlayerKeyPair? playerKeyPair, SessionToken session) { - if (Handshake(handler.GetUserUuidStr(), handler.GetUsername(), handler.GetSessionID(), handler.GetServerHost(), handler.GetServerPort())) + if (Handshake(handler.GetUserUuidStr(), handler.GetUsername(), handler.GetSessionID(), handler.GetServerHost(), handler.GetServerPort(), session)) { Send(new byte[] { 0xCD, 0 }); try diff --git a/MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs b/MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs index 94921e6c..8f85e382 100644 --- a/MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs +++ b/MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs @@ -20,8 +20,16 @@ namespace MinecraftClient.Protocol.Keys { PublicKey = keyPublic; PrivateKey = keyPrivate; - ExpiresAt = DateTime.ParseExact(expiresAt, DataTimeFormat, System.Globalization.CultureInfo.InvariantCulture).ToUniversalTime(); - RefreshedAfter = DateTime.ParseExact(refreshedAfter, DataTimeFormat, System.Globalization.CultureInfo.InvariantCulture).ToUniversalTime(); + try + { + ExpiresAt = DateTime.ParseExact(expiresAt, DataTimeFormat, System.Globalization.CultureInfo.InvariantCulture).ToUniversalTime(); + RefreshedAfter = DateTime.ParseExact(refreshedAfter, DataTimeFormat, System.Globalization.CultureInfo.InvariantCulture).ToUniversalTime(); + } + catch + { + ExpiresAt = DateTime.Parse(expiresAt).ToUniversalTime(); + RefreshedAfter = DateTime.Parse(refreshedAfter).ToUniversalTime(); + } } public bool NeedRefresh()