From a625e9bed71c6398a18ec0f5d41d7f8135660efd Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 28 Apr 2018 13:30:24 -0400 Subject: add initial multiplayer API (#480) --- .../Framework/ModHelpers/MultiplayerHelper.cs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs (limited to 'src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs') diff --git a/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs b/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs new file mode 100644 index 00000000..7a8da1d0 --- /dev/null +++ b/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs @@ -0,0 +1,31 @@ +namespace StardewModdingAPI.Framework.ModHelpers +{ + /// Provides multiplayer utilities. + internal class MultiplayerHelper : BaseHelper, IMultiplayerHelper + { + /********* + ** Properties + *********/ + /// SMAPI's core multiplayer utility. + private readonly SMultiplayer Multiplayer; + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The unique ID of the relevant mod. + /// SMAPI's core multiplayer utility. + public MultiplayerHelper(string modID, SMultiplayer multiplayer) + : base(modID) + { + this.Multiplayer = multiplayer; + } + + /// Get a new multiplayer ID. + public long GetNewID() + { + return this.Multiplayer.getNewID(); + } + } +} -- cgit From 418ff99ea3b4d06432182b147d0637cce5eb0bae Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 6 May 2018 21:00:35 -0400 Subject: add GetActiveLocations to multiplayer API (#480) --- src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs') diff --git a/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs b/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs index 7a8da1d0..c449a51b 100644 --- a/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs @@ -1,3 +1,6 @@ +using System.Collections.Generic; +using StardewValley; + namespace StardewModdingAPI.Framework.ModHelpers { /// Provides multiplayer utilities. @@ -22,6 +25,12 @@ namespace StardewModdingAPI.Framework.ModHelpers this.Multiplayer = multiplayer; } + /// Get the locations which are being actively synced from the host. + public IEnumerable GetActiveLocations() + { + return this.Multiplayer.activeLocations(); + } + /// Get a new multiplayer ID. public long GetNewID() { -- cgit