summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/TimeEvents.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Events/TimeEvents.cs')
-rw-r--r--src/SMAPI/Events/TimeEvents.cs21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/SMAPI/Events/TimeEvents.cs b/src/SMAPI/Events/TimeEvents.cs
index 311ffe9e..cca6a056 100644
--- a/src/SMAPI/Events/TimeEvents.cs
+++ b/src/SMAPI/Events/TimeEvents.cs
@@ -1,9 +1,11 @@
using System;
+using StardewModdingAPI.Framework;
using StardewModdingAPI.Framework.Events;
namespace StardewModdingAPI.Events
{
/// <summary>Events raised when the in-game date or time changes.</summary>
+ [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")]
public static class TimeEvents
{
/*********
@@ -12,6 +14,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,14 +24,22 @@ namespace StardewModdingAPI.Events
/// <summary>Raised after the game begins a new day, including when loading a save.</summary>
public static event EventHandler AfterDayStarted
{
- add => TimeEvents.EventManager.Legacy_AfterDayStarted.Add(value);
+ add
+ {
+ TimeEvents.DeprecationManager.WarnForOldEvents();
+ TimeEvents.EventManager.Legacy_AfterDayStarted.Add(value);
+ }
remove => TimeEvents.EventManager.Legacy_AfterDayStarted.Remove(value);
}
/// <summary>Raised after the in-game clock changes.</summary>
public static event EventHandler<EventArgsIntChanged> TimeOfDayChanged
{
- add => TimeEvents.EventManager.Legacy_TimeOfDayChanged.Add(value);
+ add
+ {
+ TimeEvents.DeprecationManager.WarnForOldEvents();
+ TimeEvents.EventManager.Legacy_TimeOfDayChanged.Add(value);
+ }
remove => TimeEvents.EventManager.Legacy_TimeOfDayChanged.Remove(value);
}
@@ -36,9 +49,11 @@ 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)
{
TimeEvents.EventManager = eventManager;
+ TimeEvents.DeprecationManager = deprecationManager;
}
}
}