diff --git a/MiraAPI/Events/MiraEventManager.cs b/MiraAPI/Events/MiraEventManager.cs index 4d733940..adfb2627 100644 --- a/MiraAPI/Events/MiraEventManager.cs +++ b/MiraAPI/Events/MiraEventManager.cs @@ -138,12 +138,12 @@ public static class MiraEventManager /// /// Register a handler. /// - /// The type of event. /// The of the event handler. /// The priority of the event handler. Lower values are called first. /// A to use when unregistering the event. - public static MiraEventHandle RegisterEventHandler(Type type, MethodInfo methodInfo, int priority = 0) + public static MiraEventHandle RegisterEventHandler(MethodInfo methodInfo, int priority = 0) { + Type type = methodInfo.GetParameters()[0].ParameterType; if (!type.IsAssignableTo(typeof(MiraEvent))) { throw new InvalidOperationException($"Type must be a subclass of MiraEvent: {type.FullName}"); diff --git a/MiraAPI/PluginLoading/MiraPluginManager.cs b/MiraAPI/PluginLoading/MiraPluginManager.cs index 33ef0c1e..670990ea 100644 --- a/MiraAPI/PluginLoading/MiraPluginManager.cs +++ b/MiraAPI/PluginLoading/MiraPluginManager.cs @@ -197,8 +197,7 @@ public sealed class MiraPluginManager continue; } - var paramType = parameters[0].ParameterType; - MiraEventManager.RegisterEventHandler(paramType, method, eventAttribute.Priority); + MiraEventManager.RegisterEventHandler(method, eventAttribute.Priority); } }