diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-10-29 11:29:20 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-10-29 11:29:20 -0400 |
commit | f4bc61976c1d16b9c011217c8347912cb535dc71 (patch) | |
tree | 686326f17aba167fe3a47a33d8fdd133a79484f6 /src/SMAPI/Framework/Networking | |
parent | 773ebf54065c16ce4715e8e43ab04480010cc08a (diff) | |
download | SMAPI-f4bc61976c1d16b9c011217c8347912cb535dc71.tar.gz SMAPI-f4bc61976c1d16b9c011217c8347912cb535dc71.tar.bz2 SMAPI-f4bc61976c1d16b9c011217c8347912cb535dc71.zip |
update for networking changes in SDV 1.4 (#638)
Diffstat (limited to 'src/SMAPI/Framework/Networking')
-rw-r--r-- | src/SMAPI/Framework/Networking/SGalaxyNetServer.cs | 2 | ||||
-rw-r--r-- | src/SMAPI/Framework/Networking/SLidgrenServer.cs | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs b/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs index bb67f70e..7dbfa767 100644 --- a/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs +++ b/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs @@ -58,7 +58,7 @@ namespace StardewModdingAPI.Framework.Networking { NetFarmerRoot farmer = this.Multiplayer.readFarmer(message.Reader); GalaxyID capturedPeer = new GalaxyID(peerID); - this.gameServer.checkFarmhandRequest(Convert.ToString(peerID), farmer, msg => this.sendMessage(capturedPeer, msg), () => this.peers[farmer.Value.UniqueMultiplayerID] = capturedPeer.ToUint64()); + this.gameServer.checkFarmhandRequest(Convert.ToString(peerID), this.getConnectionId(peer), farmer, msg => this.sendMessage(capturedPeer, msg), () => this.peers[farmer.Value.UniqueMultiplayerID] = capturedPeer.ToUint64()); } }); } diff --git a/src/SMAPI/Framework/Networking/SLidgrenServer.cs b/src/SMAPI/Framework/Networking/SLidgrenServer.cs index 1bce47fe..d2fec146 100644 --- a/src/SMAPI/Framework/Networking/SLidgrenServer.cs +++ b/src/SMAPI/Framework/Networking/SLidgrenServer.cs @@ -33,6 +33,10 @@ namespace StardewModdingAPI.Framework.Networking this.OnProcessingMessage = onProcessingMessage; } + + /********* + ** Protected methods + *********/ /// <summary>Parse a data message from a client.</summary> /// <param name="rawMessage">The raw network message to parse.</param> [SuppressMessage("ReSharper", "AccessToDisposedClosure", Justification = "The callback is invoked synchronously.")] @@ -55,11 +59,19 @@ namespace StardewModdingAPI.Framework.Networking else if (message.MessageType == StardewValley.Multiplayer.playerIntroduction) { NetFarmerRoot farmer = this.Multiplayer.readFarmer(message.Reader); - this.gameServer.checkFarmhandRequest("", farmer, msg => this.sendMessage(peer, msg), () => this.peers[farmer.Value.UniqueMultiplayerID] = peer); + this.gameServer.checkFarmhandRequest("", this.getConnectionId(rawMessage.SenderConnection), farmer, msg => this.sendMessage(peer, msg), () => this.peers[farmer.Value.UniqueMultiplayerID] = peer); } }); } } } + + /// <summary>Get the connection ID for a connection.</summary> + /// <param name="connection">The connection.</param> + /// <remarks>Derived from the private <see cref="LidgrenServer.getConnectionId"/> method.</remarks> + private string getConnectionId(NetConnection connection) + { + return $"L_{connection.RemoteUniqueIdentifier}"; + } } } |