From 5b0fee007907accd2577ca91f09edd14b2dddedb Mon Sep 17 00:00:00 2001
From: David Higueros <111460331+TheDavSmasher@users.noreply.github.com>
Date: Wed, 4 Nov 2026 14:23:17 -0700
Subject: [PATCH] Removed parameter that should be calculated to prevent
desyncs or type errors
---
MiraAPI/Events/MiraEventManager.cs | 4 ++--
MiraAPI/PluginLoading/MiraPluginManager.cs | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
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);
}
}