using StardewModdingAPI.Framework.Events; using StardewValley; namespace StardewModdingAPI.Framework { /// SMAPI's implementation of the game's core multiplayer logic. internal class SMultiplayer : Multiplayer { /********* ** Properties *********/ /// Encapsulates monitoring and logging. private readonly IMonitor Monitor; /// Manages SMAPI events. private readonly EventManager EventManager; /********* ** Public methods *********/ /// Construct an instance. /// Encapsulates monitoring and logging. /// Manages SMAPI events. public SMultiplayer(IMonitor monitor, EventManager eventManager) { this.Monitor = monitor; this.EventManager = eventManager; } /// Handle sync messages from other players and perform other initial sync logic. public override void UpdateEarly() { this.EventManager.Legacy_BeforeMainSync.Raise(); base.UpdateEarly(); this.EventManager.Legacy_AfterMainSync.Raise(); } /// Broadcast sync messages to other players and perform other final sync logic. public override void UpdateLate(bool forceSync = false) { this.EventManager.Legacy_BeforeMainBroadcast.Raise(); base.UpdateLate(forceSync); this.EventManager.Legacy_AfterMainBroadcast.Raise(); } } }