summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-06-15 18:58:05 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-06-15 18:58:05 -0400
commitfc29fe918a89623544b011c76217aa1ea1975d00 (patch)
treef12de32f394725ff35c26d786f3ff7f455828690 /src/SMAPI/Events
parentb395e92faae0a197a2d1c2e10e835e38fcc6502c (diff)
downloadSMAPI-fc29fe918a89623544b011c76217aa1ea1975d00.tar.gz
SMAPI-fc29fe918a89623544b011c76217aa1ea1975d00.tar.bz2
SMAPI-fc29fe918a89623544b011c76217aa1ea1975d00.zip
refactor & optimize event code a bit, drop old support for unknown event handlers
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r--src/SMAPI/Events/EventPriority.cs24
-rw-r--r--src/SMAPI/Events/EventPriorityAttribute.cs31
2 files changed, 19 insertions, 36 deletions
diff --git a/src/SMAPI/Events/EventPriority.cs b/src/SMAPI/Events/EventPriority.cs
index 17f5fbb7..e1fb00ac 100644
--- a/src/SMAPI/Events/EventPriority.cs
+++ b/src/SMAPI/Events/EventPriority.cs
@@ -1,29 +1,15 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
namespace StardewModdingAPI.Events
{
- /// <summary>
- /// Event priority for method handlers.
- /// </summary>
+ /// <summary>The event priorities for method handlers.</summary>
public enum EventPriority
{
- /// <summary>
- /// Low priority.
- /// </summary>
+ /// <summary>Low priority.</summary>
Low = 3,
- /// <summary>
- /// Normal priority. This is the default.
- /// </summary>
+ /// <summary>The default priority.</summary>
Normal = 2,
- /// <summary>
- /// High priority.
- /// </summary>
- High = 1,
+ /// <summary>High priority.</summary>
+ High = 1
}
}
diff --git a/src/SMAPI/Events/EventPriorityAttribute.cs b/src/SMAPI/Events/EventPriorityAttribute.cs
index c5683931..207e7862 100644
--- a/src/SMAPI/Events/EventPriorityAttribute.cs
+++ b/src/SMAPI/Events/EventPriorityAttribute.cs
@@ -1,27 +1,24 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace StardewModdingAPI.Events
{
- /// <summary>
- /// An attribute for controlling event priority of an event handler.
- /// </summary>
+ /// <summary>An attribute which specifies the priority for an event handler.</summary>
[AttributeUsage(AttributeTargets.Method)]
- public class EventPriorityAttribute : System.Attribute
+ public class EventPriorityAttribute : Attribute
{
- /// <summary>
- /// The priority for the method marked by this attribute.
- /// </summary>
- public EventPriority Priority { get; }
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The event handler priority, relative to other handlers across all mods registered for this event.</summary>
+ internal EventPriority Priority { get; }
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="priority">The priority for method marked by this attribute.</param>
- public EventPriorityAttribute( EventPriority priority )
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="priority">The event handler priority, relative to other handlers across all mods registered for this event. Higher-priority handlers are notified before lower-priority handlers.</param>
+ public EventPriorityAttribute(EventPriority priority)
{
this.Priority = priority;
}