diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2018-12-07 13:40:44 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2018-12-07 13:40:44 -0500 |
commit | a78b1935928919694dfe8de823a1accd6d222732 (patch) | |
tree | 3f17b6087cf2749e52c1e237de17e2e9addb6c06 /src/SMAPI/Events/LocationEvents.cs | |
parent | 4cd9eda1591c3908bf80b60c2902491a7595ee27 (diff) | |
parent | 8901218418693d610a17b22fe789ba6279f63446 (diff) | |
download | SMAPI-a78b1935928919694dfe8de823a1accd6d222732.tar.gz SMAPI-a78b1935928919694dfe8de823a1accd6d222732.tar.bz2 SMAPI-a78b1935928919694dfe8de823a1accd6d222732.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Events/LocationEvents.cs')
-rw-r--r-- | src/SMAPI/Events/LocationEvents.cs | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/SMAPI/Events/LocationEvents.cs b/src/SMAPI/Events/LocationEvents.cs index 81f547ae..e0bcd853 100644 --- a/src/SMAPI/Events/LocationEvents.cs +++ b/src/SMAPI/Events/LocationEvents.cs @@ -1,9 +1,12 @@ +#if !SMAPI_3_0_STRICT using System; +using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.Events; namespace StardewModdingAPI.Events { /// <summary>Events raised when the player transitions between game locations, a location is added or removed, or the objects in the current location change.</summary> + [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] public static class LocationEvents { /********* @@ -12,6 +15,9 @@ namespace StardewModdingAPI.Events /// <summary>The core event manager.</summary> private static EventManager EventManager; + /// <summary>Manages deprecation warnings.</summary> + private static DeprecationManager DeprecationManager; + /********* ** Events @@ -19,21 +25,33 @@ namespace StardewModdingAPI.Events /// <summary>Raised after a game location is added or removed.</summary> public static event EventHandler<EventArgsLocationsChanged> LocationsChanged { - add => LocationEvents.EventManager.Legacy_LocationsChanged.Add(value); + add + { + LocationEvents.DeprecationManager.WarnForOldEvents(); + LocationEvents.EventManager.Legacy_LocationsChanged.Add(value); + } remove => LocationEvents.EventManager.Legacy_LocationsChanged.Remove(value); } /// <summary>Raised after buildings are added or removed in a location.</summary> public static event EventHandler<EventArgsLocationBuildingsChanged> BuildingsChanged { - add => LocationEvents.EventManager.Legacy_BuildingsChanged.Add(value); + add + { + LocationEvents.DeprecationManager.WarnForOldEvents(); + LocationEvents.EventManager.Legacy_BuildingsChanged.Add(value); + } remove => LocationEvents.EventManager.Legacy_BuildingsChanged.Remove(value); } /// <summary>Raised after objects are added or removed in a location.</summary> public static event EventHandler<EventArgsLocationObjectsChanged> ObjectsChanged { - add => LocationEvents.EventManager.Legacy_ObjectsChanged.Add(value); + add + { + LocationEvents.DeprecationManager.WarnForOldEvents(); + LocationEvents.EventManager.Legacy_ObjectsChanged.Add(value); + } remove => LocationEvents.EventManager.Legacy_ObjectsChanged.Remove(value); } @@ -43,9 +61,12 @@ namespace StardewModdingAPI.Events *********/ /// <summary>Initialise the events.</summary> /// <param name="eventManager">The core event manager.</param> - internal static void Init(EventManager eventManager) + /// <param name="deprecationManager">Manages deprecation warnings.</param> + internal static void Init(EventManager eventManager, DeprecationManager deprecationManager) { LocationEvents.EventManager = eventManager; + LocationEvents.DeprecationManager = deprecationManager; } } } +#endif |