diff --git a/docs/release-notes.md b/docs/release-notes.md index 467f2298..813f40a7 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -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: diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 4d790d9f..d515d3ad 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -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(); diff --git a/src/SMAPI/Framework/SMultiplayer.cs b/src/SMAPI/Framework/SMultiplayer.cs index 784edae3..29d9b2b8 100644 --- a/src/SMAPI/Framework/SMultiplayer.cs +++ b/src/SMAPI/Framework/SMultiplayer.cs @@ -82,6 +82,13 @@ namespace StardewModdingAPI.Framework this.OnModMessageReceived = onModMessageReceived; } + /// Perform cleanup needed when a multiplayer session ends. + public void CleanupOnMultiplayerExit() + { + this.Peers.Clear(); + this.HostPeer = null; + } + #if !SMAPI_3_0_STRICT /// Handle sync messages from other players and perform other initial sync logic. public override void UpdateEarly()