fix error when leaving & rejoining a server in the same session

This commit is contained in:
Jesse Plamondon-Willard 2018-11-25 13:14:45 -05:00
parent cbd63b9a87
commit b34cbb5b86
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
2 changed files with 11 additions and 5 deletions

View File

@ -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:

View File

@ -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