summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/LocationEvents.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-12-07 13:40:44 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-12-07 13:40:44 -0500
commita78b1935928919694dfe8de823a1accd6d222732 (patch)
tree3f17b6087cf2749e52c1e237de17e2e9addb6c06 /src/SMAPI/Events/LocationEvents.cs
parent4cd9eda1591c3908bf80b60c2902491a7595ee27 (diff)
parent8901218418693d610a17b22fe789ba6279f63446 (diff)
downloadSMAPI-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.cs29
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