diff options
author | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
commit | e9ea621b93fbb58d9edfca8375918791637bbd52 (patch) | |
tree | 19ce3b1c1f2d51eda6878c9d0f2c9edc27f13650 /Impostor-dev/src/Impostor.Api/Events/Attributes |
+init
Diffstat (limited to 'Impostor-dev/src/Impostor.Api/Events/Attributes')
-rw-r--r-- | Impostor-dev/src/Impostor.Api/Events/Attributes/EventListenerAttribute.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Impostor-dev/src/Impostor.Api/Events/Attributes/EventListenerAttribute.cs b/Impostor-dev/src/Impostor.Api/Events/Attributes/EventListenerAttribute.cs new file mode 100644 index 0000000..b31d2d1 --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Events/Attributes/EventListenerAttribute.cs @@ -0,0 +1,34 @@ +using System; + +namespace Impostor.Api.Events +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] + public class EventListenerAttribute : Attribute + { + public EventListenerAttribute(EventPriority priority = EventPriority.Normal) + { + Priority = priority; + } + + public EventListenerAttribute(Type @event, EventPriority priority = EventPriority.Normal) + { + Priority = priority; + Event = @event; + } + + /// <summary> + /// The priority of the event listener. + /// </summary> + public EventPriority Priority { get; set; } + + /// <summary> + /// The events that the listener is listening to. + /// </summary> + public Type? Event { get; set; } + + /// <summary> + /// If set to true, the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled"/>. + /// </summary> + public bool IgnoreCancelled { get; set; } + } +}
\ No newline at end of file |