summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/SGame.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-02-22 23:01:43 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-02-22 23:01:43 -0500
commit02a96b54b5acc80fcb61a3072549cb8e434b134e (patch)
treeb862522a057485e0578bdb80b246d7d4c054c0bd /src/SMAPI/Framework/SGame.cs
parentf98f61e6d891c43adae4494b84705dee369829f7 (diff)
downloadSMAPI-02a96b54b5acc80fcb61a3072549cb8e434b134e.tar.gz
SMAPI-02a96b54b5acc80fcb61a3072549cb8e434b134e.tar.bz2
SMAPI-02a96b54b5acc80fcb61a3072549cb8e434b134e.zip
fix mods receiving their own broadcasts
Diffstat (limited to 'src/SMAPI/Framework/SGame.cs')
-rw-r--r--src/SMAPI/Framework/SGame.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index 6b9c1365..b2d92ce8 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -226,8 +226,12 @@ namespace StardewModdingAPI.Framework
/// <param name="message">The message to deliver to applicable mods.</param>
private void OnModMessageReceived(ModMessageModel message)
{
- // raise events for applicable mods
+ // get mod IDs to notify
HashSet<string> modIDs = new HashSet<string>(message.ToModIDs ?? this.ModRegistry.GetAll().Select(p => p.Manifest.UniqueID), StringComparer.InvariantCultureIgnoreCase);
+ if (message.FromPlayerID == Game1.player?.UniqueMultiplayerID)
+ modIDs.Remove(message.FromModID); // don't send a broadcast back to the sender
+
+ // raise events
this.Events.ModMessageReceived.RaiseForMods(new ModMessageReceivedEventArgs(message), mod => mod != null && modIDs.Contains(mod.Manifest.UniqueID));
}