fix host peer not cleared when a multiplayer session ends

This commit is contained in:
Jesse Plamondon-Willard 2018-12-16 20:28:02 -05:00
parent 8dd94ac7f1
commit 22297e2ee4
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
3 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,8 @@
# Release notes
## 2.9.3
* Fixed errors hovering items in some cases with SMAPI 2.9.2.
* For players:
* Fixed errors hovering items in some cases with SMAPI 2.9.2.
* Fixed some multiplayer features broken when a farmhand returns to title and rejoins.
## 2.9.2
* For players:

View File

@ -217,7 +217,7 @@ namespace StardewModdingAPI.Framework
private void OnReturnedToTitle()
{
this.Monitor.Log("Context: returned to title", LogLevel.Trace);
this.Multiplayer.Peers.Clear();
this.Multiplayer.CleanupOnMultiplayerExit();
this.Events.ReturnedToTitle.RaiseEmpty();
#if !SMAPI_3_0_STRICT
this.Events.Legacy_AfterReturnToTitle.Raise();

View File

@ -82,6 +82,13 @@ namespace StardewModdingAPI.Framework
this.OnModMessageReceived = onModMessageReceived;
}
/// <summary>Perform cleanup needed when a multiplayer session ends.</summary>
public void CleanupOnMultiplayerExit()
{
this.Peers.Clear();
this.HostPeer = null;
}
#if !SMAPI_3_0_STRICT
/// <summary>Handle sync messages from other players and perform other initial sync logic.</summary>
public override void UpdateEarly()