#if !SMAPI_3_0_STRICT using System; using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.Events; namespace StardewModdingAPI.Events { /// Events raised when the player transitions between game locations, a location is added or removed, or the objects in the current location change. [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] public static class LocationEvents { /********* ** Properties *********/ /// The core event manager. private static EventManager EventManager; /// Manages deprecation warnings. private static DeprecationManager DeprecationManager; /********* ** Events *********/ /// Raised after a game location is added or removed. public static event EventHandler LocationsChanged { add { LocationEvents.DeprecationManager.WarnForOldEvents(); LocationEvents.EventManager.Legacy_LocationsChanged.Add(value); } remove => LocationEvents.EventManager.Legacy_LocationsChanged.Remove(value); } /// Raised after buildings are added or removed in a location. public static event EventHandler BuildingsChanged { add { LocationEvents.DeprecationManager.WarnForOldEvents(); LocationEvents.EventManager.Legacy_BuildingsChanged.Add(value); } remove => LocationEvents.EventManager.Legacy_BuildingsChanged.Remove(value); } /// Raised after objects are added or removed in a location. public static event EventHandler ObjectsChanged { add { LocationEvents.DeprecationManager.WarnForOldEvents(); LocationEvents.EventManager.Legacy_ObjectsChanged.Add(value); } remove => LocationEvents.EventManager.Legacy_ObjectsChanged.Remove(value); } /********* ** Public methods *********/ /// Initialise the events. /// The core event manager. /// Manages deprecation warnings. internal static void Init(EventManager eventManager, DeprecationManager deprecationManager) { LocationEvents.EventManager = eventManager; LocationEvents.DeprecationManager = deprecationManager; } } } #endif