better handle player reconnecting before disconnection is registered

This commit is contained in:
Jesse Plamondon-Willard 2019-02-18 01:33:10 -05:00
parent 0ba8325708
commit 4a297e29eb
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ These changes have not been released yet.
* For players: * For players:
* Fixed Save Backup not pruning old backups if they're uncompressed. * Fixed Save Backup not pruning old backups if they're uncompressed.
* Fixed issues when a farmhand reconnects before the game notices they're disconnected.
* For modders: * For modders:
* Added `IContentPack.HasFile` method. * Added `IContentPack.HasFile` method.

View File

@ -201,7 +201,8 @@ namespace StardewModdingAPI.Framework
MultiplayerPeer newPeer = new MultiplayerPeer(message.FarmerID, model, sendMessage, isHost: false); MultiplayerPeer newPeer = new MultiplayerPeer(message.FarmerID, model, sendMessage, isHost: false);
if (this.Peers.ContainsKey(message.FarmerID)) if (this.Peers.ContainsKey(message.FarmerID))
{ {
this.Monitor.Log($"Rejected mod context from farmhand {message.FarmerID}: already received context for that player.", LogLevel.Error); this.Monitor.Log($"Received mod context from farmhand {message.FarmerID}, but the game didn't see them disconnect. This may indicate issues with the network connection.", LogLevel.Info);
this.Peers.Remove(message.FarmerID);
return; return;
} }
this.AddPeer(newPeer, canBeHost: false, raiseEvent: false); this.AddPeer(newPeer, canBeHost: false, raiseEvent: false);