fix mods receiving their own broadcasts
This commit is contained in:
parent
f98f61e6d8
commit
02a96b54b5
|
@ -1,6 +1,9 @@
|
|||
← [README](README.md)
|
||||
|
||||
# Release notes
|
||||
## Upcoming release
|
||||
* Fixed mods receiving their own message broadcasts.
|
||||
|
||||
## 3.3.1
|
||||
Released 22 February 2020 for Stardew Valley 1.4.1 or later.
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue