diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2018-12-03 01:43:02 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2018-12-04 23:49:05 -0500 |
commit | a2a0469cd024e2fd4b35503db152ba1a6df712ec (patch) | |
tree | d64da19a1413bb29425005c1ff4d200e914f73bb /src/SMAPI/Events/ContentEvents.cs | |
parent | 3c5bdc96b57b523fb389dda5138b57fc5801edd2 (diff) | |
download | SMAPI-a2a0469cd024e2fd4b35503db152ba1a6df712ec.tar.gz SMAPI-a2a0469cd024e2fd4b35503db152ba1a6df712ec.tar.bz2 SMAPI-a2a0469cd024e2fd4b35503db152ba1a6df712ec.zip |
deprecate old events (#606)
Diffstat (limited to 'src/SMAPI/Events/ContentEvents.cs')
-rw-r--r-- | src/SMAPI/Events/ContentEvents.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/SMAPI/Events/ContentEvents.cs b/src/SMAPI/Events/ContentEvents.cs index 3ee0560b..3bf3881b 100644 --- a/src/SMAPI/Events/ContentEvents.cs +++ b/src/SMAPI/Events/ContentEvents.cs @@ -1,9 +1,11 @@ using System; +using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.Events; namespace StardewModdingAPI.Events { /// <summary>Events raised when the game loads content.</summary> + [Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")] public static class ContentEvents { /********* @@ -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,7 +24,11 @@ namespace StardewModdingAPI.Events /// <summary>Raised after the content language changes.</summary> public static event EventHandler<EventArgsValueChanged<string>> AfterLocaleChanged { - add => ContentEvents.EventManager.Legacy_LocaleChanged.Add(value); + add + { + ContentEvents.DeprecationManager.WarnForOldEvents(); + ContentEvents.EventManager.Legacy_LocaleChanged.Add(value); + } remove => ContentEvents.EventManager.Legacy_LocaleChanged.Remove(value); } @@ -29,9 +38,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) { ContentEvents.EventManager = eventManager; + ContentEvents.DeprecationManager = deprecationManager; } } } |