diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-12 00:21:52 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-12 00:21:52 -0400 |
commit | a9cadc7f32fd9fd244fc3e22c62a35e7c257c084 (patch) | |
tree | d07a8b34608f46948505755a599c07da65a7fde7 /src/SMAPI/Framework/SMultiplayer.cs | |
parent | 09f69d986f4f44521d8a2cd745269dce4b83320e (diff) | |
parent | e943ae84136d46432e04e577041850d2aa7db43e (diff) | |
download | SMAPI-a9cadc7f32fd9fd244fc3e22c62a35e7c257c084.tar.gz SMAPI-a9cadc7f32fd9fd244fc3e22c62a35e7c257c084.tar.bz2 SMAPI-a9cadc7f32fd9fd244fc3e22c62a35e7c257c084.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/SMultiplayer.cs')
-rw-r--r-- | src/SMAPI/Framework/SMultiplayer.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/SMAPI/Framework/SMultiplayer.cs b/src/SMAPI/Framework/SMultiplayer.cs index 2badcbbf..441a50ef 100644 --- a/src/SMAPI/Framework/SMultiplayer.cs +++ b/src/SMAPI/Framework/SMultiplayer.cs @@ -235,7 +235,8 @@ namespace StardewModdingAPI.Framework } // raise event - this.EventManager.PeerContextReceived.Raise(new PeerContextReceivedEventArgs(newPeer)); + if (this.EventManager.PeerContextReceived.HasListeners) + this.EventManager.PeerContextReceived.Raise(new PeerContextReceivedEventArgs(newPeer)); } break; @@ -259,7 +260,8 @@ namespace StardewModdingAPI.Framework resume(); // raise event - this.EventManager.PeerConnected.Raise(new PeerConnectedEventArgs(this.Peers[message.FarmerID])); + if (this.EventManager.PeerConnected.HasListeners) + this.EventManager.PeerConnected.Raise(new PeerConnectedEventArgs(this.Peers[message.FarmerID])); break; // handle mod message @@ -370,7 +372,9 @@ namespace StardewModdingAPI.Framework { this.Monitor.Log($"Player quit: {playerID}"); this.Peers.Remove(playerID); - this.EventManager.PeerDisconnected.Raise(new PeerDisconnectedEventArgs(peer)); + + if (this.EventManager.PeerDisconnected.HasListeners) + this.EventManager.PeerDisconnected.Raise(new PeerDisconnectedEventArgs(peer)); } } @@ -481,7 +485,7 @@ namespace StardewModdingAPI.Framework this.HostPeer = peer; // raise event - if (raiseEvent) + if (raiseEvent && this.EventManager.PeerContextReceived.HasListeners) this.EventManager.PeerContextReceived.Raise(new PeerContextReceivedEventArgs(peer)); } |