summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events/TimeEvents.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-01-15 19:21:26 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-01-15 19:21:26 -0500
commit64a72c45e3c4b504c7a1b61a539f1cbc9b9d23cc (patch)
tree8648e73314fdf8a2b957d2bd3e3b651799d46888 /src/StardewModdingAPI/Events/TimeEvents.cs
parent0c73b02d58712f7f340f4326143d5439d6cd7f93 (diff)
downloadSMAPI-64a72c45e3c4b504c7a1b61a539f1cbc9b9d23cc.tar.gz
SMAPI-64a72c45e3c4b504c7a1b61a539f1cbc9b9d23cc.tar.bz2
SMAPI-64a72c45e3c4b504c7a1b61a539f1cbc9b9d23cc.zip
deprecate events replaced by save events (#215)
Diffstat (limited to 'src/StardewModdingAPI/Events/TimeEvents.cs')
-rw-r--r--src/StardewModdingAPI/Events/TimeEvents.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/StardewModdingAPI/Events/TimeEvents.cs b/src/StardewModdingAPI/Events/TimeEvents.cs
index 1b367230..dedd7e77 100644
--- a/src/StardewModdingAPI/Events/TimeEvents.cs
+++ b/src/StardewModdingAPI/Events/TimeEvents.cs
@@ -22,6 +22,7 @@ namespace StardewModdingAPI.Events
public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged;
/// <summary>Raised when the player is transitioning to a new day and the game is performing its day update logic. This event is triggered twice: once after the game starts transitioning, and again after it finishes.</summary>
+ [Obsolete("Use " + nameof(TimeEvents) + "." + nameof(DayOfMonthChanged) + " or " + nameof(SaveEvents) + " instead")]
public static event EventHandler<EventArgsNewDay> OnNewDay;
@@ -71,7 +72,14 @@ namespace StardewModdingAPI.Events
/// <param name="isTransitioning">Whether the game just started the transition (<c>true</c>) or finished it (<c>false</c>).</param>
internal static void InvokeOnNewDay(IMonitor monitor, int priorDay, int newDay, bool isTransitioning)
{
- monitor.SafelyRaiseGenericEvent($"{nameof(TimeEvents)}.{nameof(TimeEvents.OnNewDay)}", TimeEvents.OnNewDay?.GetInvocationList(), null, new EventArgsNewDay(priorDay, newDay, isTransitioning));
+ if (TimeEvents.OnNewDay == null)
+ return;
+
+ string name = $"{nameof(TimeEvents)}.{nameof(TimeEvents.OnNewDay)}";
+ Delegate[] handlers = TimeEvents.OnNewDay.GetInvocationList();
+
+ Program.DeprecationManager.WarnForEvent(handlers, name, "1.6", DeprecationLevel.Notice);
+ monitor.SafelyRaiseGenericEvent(name, handlers, null, new EventArgsNewDay(priorDay, newDay, isTransitioning));
}
}
}