summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/LocationEvents.cs
diff options
context:
space:
mode:
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