Skip to content

Commit

Permalink
Assign TotalTime/LastLogin earlier in login process to avoid a small …
Browse files Browse the repository at this point in the history
…window where a player in Onelist list has nonsensical TotalTime/LastLogin values (Thanks Spicycombo)
  • Loading branch information
UnknownShadow200 committed Mar 19, 2023
1 parent 18afc1f commit 8dde70e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions MCGalaxy/Player/Player.Login.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public partial class Player : IDisposable
OnPlayerFinishConnectingEvent.Call(this);
if (cancelconnecting) { cancelconnecting = false; return; }

SessionStartTime = DateTime.UtcNow;
LastLogin = DateTime.Now;
TotalTime = TimeSpan.FromSeconds(1);

lock (PlayerInfo.Online.locker) {
// Check if any players online have same name
clone = FindClone(truename);
Expand All @@ -87,9 +91,6 @@ public partial class Player : IDisposable
if (Socket.Disconnected) return;
loggedIn = true;

SessionStartTime = DateTime.UtcNow;
LastLogin = DateTime.Now;
TotalTime = TimeSpan.FromSeconds(1);
GetPlayerStats();
ShowWelcome();
CheckState();
Expand Down

0 comments on commit 8dde70e

Please sign in to comment.