diff options
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI/Framework/SGame.cs | 15 |
2 files changed, 11 insertions, 5 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 2f229d38..c2b58cd2 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,6 +2,7 @@ ## Upcoming * For players: * Fixed cryptic error when running the installer from inside a zip file on Windows. + * Fixed error when leaving and rejoining a multiplayer server in the same session. * Fixed Console Commands' handling of tool upgrade levels for item commands. * For modders: diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 75cf4c52..9c6ff4dd 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -206,6 +206,15 @@ namespace StardewModdingAPI.Framework this.Events.ModMessageReceived.RaiseForMods(new ModMessageReceivedEventArgs(message), mod => mod != null && modIDs.Contains(mod.Manifest.UniqueID)); } + /// <summary>A callback raised when the player quits a save and returns to the title screen.</summary> + private void OnReturnedToTitle() + { + this.Monitor.Log("Context: returned to title", LogLevel.Trace); + this.Multiplayer.Peers.Clear(); + this.Events.ReturnedToTitle.RaiseEmpty(); + this.Events.Legacy_AfterReturnToTitle.Raise(); + } + /// <summary>Constructor a content manager to read XNB files.</summary> /// <param name="serviceProvider">The service provider to use to locate services.</param> /// <param name="rootDirectory">The root directory to search for content.</param> @@ -430,11 +439,7 @@ namespace StardewModdingAPI.Framework ** Load / return-to-title events *********/ if (wasWorldReady && !Context.IsWorldReady) - { - this.Monitor.Log("Context: returned to title", LogLevel.Trace); - this.Events.ReturnedToTitle.RaiseEmpty(); - this.Events.Legacy_AfterReturnToTitle.Raise(); - } + this.OnReturnedToTitle(); else if (!this.RaisedAfterLoadEvent && Context.IsWorldReady) { // print context |