summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Networking/MultiplayerPeer.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
commitc8ad50dad1d706a1901798f9396f6becfea36c0e (patch)
tree28bd818a5db39ec5ece1bd141a28de955950463b /src/SMAPI/Framework/Networking/MultiplayerPeer.cs
parent451b70953ff4c0b1b27ae0de203ad99379b45b2a (diff)
parentf78093bdb58d477b400cde3f19b70ffd6ddf833d (diff)
downloadSMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.gz
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.bz2
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/Networking/MultiplayerPeer.cs')
-rw-r--r--src/SMAPI/Framework/Networking/MultiplayerPeer.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/SMAPI/Framework/Networking/MultiplayerPeer.cs b/src/SMAPI/Framework/Networking/MultiplayerPeer.cs
index 3923700f..b37c1e89 100644
--- a/src/SMAPI/Framework/Networking/MultiplayerPeer.cs
+++ b/src/SMAPI/Framework/Networking/MultiplayerPeer.cs
@@ -37,10 +37,10 @@ namespace StardewModdingAPI.Framework.Networking
public GamePlatform? Platform { get; }
/// <inheritdoc />
- public ISemanticVersion GameVersion { get; }
+ public ISemanticVersion? GameVersion { get; }
/// <inheritdoc />
- public ISemanticVersion ApiVersion { get; }
+ public ISemanticVersion? ApiVersion { get; }
/// <inheritdoc />
public IEnumerable<IMultiplayerPeerMod> Mods { get; }
@@ -55,11 +55,12 @@ namespace StardewModdingAPI.Framework.Networking
/// <param name="model">The metadata to copy.</param>
/// <param name="sendMessage">A method which sends a message to the peer.</param>
/// <param name="isHost">Whether this is a connection to the host player.</param>
- public MultiplayerPeer(long playerID, int? screenID, RemoteContextModel model, Action<OutgoingMessage> sendMessage, bool isHost)
+ public MultiplayerPeer(long playerID, int? screenID, RemoteContextModel? model, Action<OutgoingMessage> sendMessage, bool isHost)
{
this.PlayerID = playerID;
this.ScreenID = screenID;
this.IsHost = isHost;
+
if (model != null)
{
this.Platform = model.Platform;
@@ -67,13 +68,16 @@ namespace StardewModdingAPI.Framework.Networking
this.ApiVersion = model.ApiVersion;
this.Mods = model.Mods.Select(mod => new MultiplayerPeerMod(mod)).ToArray();
}
+ else
+ this.Mods = Array.Empty<IMultiplayerPeerMod>();
+
this.SendMessageImpl = sendMessage;
}
/// <inheritdoc />
- public IMultiplayerPeerMod GetMod(string id)
+ public IMultiplayerPeerMod? GetMod(string? id)
{
- if (string.IsNullOrWhiteSpace(id) || this.Mods == null || !this.Mods.Any())
+ if (string.IsNullOrWhiteSpace(id) || !this.Mods.Any())
return null;
id = id.Trim();