summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Events/ManagedEvent.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-05-31 22:47:56 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-05-31 22:47:56 -0400
commit558fb8a865b638cf5536856e7dcab44823feeaf3 (patch)
tree6ae854fa005858dfd6b55b123a78ce1d66eac466 /src/SMAPI/Framework/Events/ManagedEvent.cs
parente5f8b1419afa2ad4bece4fde2286b967476c1031 (diff)
downloadSMAPI-558fb8a865b638cf5536856e7dcab44823feeaf3.tar.gz
SMAPI-558fb8a865b638cf5536856e7dcab44823feeaf3.tar.bz2
SMAPI-558fb8a865b638cf5536856e7dcab44823feeaf3.zip
move location events into new event system (#310)
Diffstat (limited to 'src/SMAPI/Framework/Events/ManagedEvent.cs')
-rw-r--r--src/SMAPI/Framework/Events/ManagedEvent.cs20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/Events/ManagedEvent.cs b/src/SMAPI/Framework/Events/ManagedEvent.cs
index e54a4fd3..c1ebf6c7 100644
--- a/src/SMAPI/Framework/Events/ManagedEvent.cs
+++ b/src/SMAPI/Framework/Events/ManagedEvent.cs
@@ -28,8 +28,16 @@ namespace StardewModdingAPI.Framework.Events
/// <param name="handler">The event handler.</param>
public void Add(EventHandler<TEventArgs> handler)
{
+ this.Add(handler, this.ModRegistry.GetFromStack());
+ }
+
+ /// <summary>Add an event handler.</summary>
+ /// <param name="handler">The event handler.</param>
+ /// <param name="mod">The mod which added the event handler.</param>
+ public void Add(EventHandler<TEventArgs> handler, IModMetadata mod)
+ {
this.Event += handler;
- this.AddTracking(handler, this.Event?.GetInvocationList().Cast<EventHandler<TEventArgs>>());
+ this.AddTracking(mod, handler, this.Event?.GetInvocationList().Cast<EventHandler<TEventArgs>>());
}
/// <summary>Remove an event handler.</summary>
@@ -85,8 +93,16 @@ namespace StardewModdingAPI.Framework.Events
/// <param name="handler">The event handler.</param>
public void Add(EventHandler handler)
{
+ this.Add(handler, this.ModRegistry.GetFromStack());
+ }
+
+ /// <summary>Add an event handler.</summary>
+ /// <param name="handler">The event handler.</param>
+ /// <param name="mod">The mod which added the event handler.</param>
+ public void Add(EventHandler handler, IModMetadata mod)
+ {
this.Event += handler;
- this.AddTracking(handler, this.Event?.GetInvocationList().Cast<EventHandler>());
+ this.AddTracking(mod, handler, this.Event?.GetInvocationList().Cast<EventHandler>());
}
/// <summary>Remove an event handler.</summary>