diff --git a/MiraAPI/Events/MiraEventHandle.cs b/MiraAPI/Events/MiraEventHandle.cs index 9c820621..19482f41 100644 --- a/MiraAPI/Events/MiraEventHandle.cs +++ b/MiraAPI/Events/MiraEventHandle.cs @@ -16,18 +16,18 @@ public class MiraEventHandle /// /// Gets the priority of the handler. Lower values are called first. /// - internal int Priority { get; } + public int Priority { get; } /// /// Gets the event handler delegate. /// - internal Delegate EventHandler { get; } + public Delegate EventHandler { get; } /// /// Gets a value indicating whether the event handler should also be - /// tirggered by subclasses of . + /// triggered by subclasses of . /// - internal bool InvokeOnSubtype { get; } + public bool InvokeOnSubtype { get; } internal MiraEventHandle(Delegate eventHandler, int priority, Type type, bool invokeOnSubtype) { diff --git a/MiraAPI/Events/MiraEventManager.cs b/MiraAPI/Events/MiraEventManager.cs index 4b25ca78..60bb38dd 100644 --- a/MiraAPI/Events/MiraEventManager.cs +++ b/MiraAPI/Events/MiraEventManager.cs @@ -27,7 +27,7 @@ public static class MiraEventManager private static readonly Dictionary> TrackedEventTypes = []; - private static bool loadFinilized = false; + private static bool loadFinalized = false; /// /// Invoke a . @@ -77,7 +77,7 @@ public static class MiraEventManager internal static bool RegisterEventType(Type eventType, MiraPluginInfo info) { - if (!eventType.IsSubclassOf(typeof(MiraEvent))) + if (eventType.IsAbstract || !eventType.IsSubclassOf(typeof(MiraEvent))) { return false; } @@ -243,7 +243,7 @@ public static class MiraEventManager private static void EventHandlerAdded(Type type, MiraEventHandle eventHandler) { - if (!loadFinilized) + if (!loadFinalized) { EventHandlersToLoad.TryAdd(type, []); EventHandlersToLoad[type].Add(eventHandler); @@ -277,7 +277,7 @@ public static class MiraEventManager /// if the event was unregistered successfully, otherwise. public static bool UnregisterEventHandler(MiraEventHandle eventHandle) { - if (!loadFinilized) + if (!loadFinalized) { if (!EventHandlersToLoad.TryGetValue(eventHandle.EventType, out var handlersToLoad)) { @@ -311,9 +311,9 @@ public static class MiraEventManager return removed; } - internal static void OnLoadFinilize() + internal static void OnLoadFinalize() { - loadFinilized = true; + loadFinalized = true; EventTypes = new ReadOnlyCollection(InternalEventTypes); foreach (var eventType in EventTypes) diff --git a/MiraAPI/PluginLoading/MiraPluginManager.cs b/MiraAPI/PluginLoading/MiraPluginManager.cs index 58d4f7bb..4f83cb80 100644 --- a/MiraAPI/PluginLoading/MiraPluginManager.cs +++ b/MiraAPI/PluginLoading/MiraPluginManager.cs @@ -104,7 +104,7 @@ public sealed class MiraPluginManager PluginsWithOptionsOrGameModes = [.. RegisteredPlugins.Where(m => m.MiraPlugin.DisplayOnOptionsMenu || m.GameModes.Count > 0)]; ModifierManager.Modifiers = new ReadOnlyCollection(ModifierManager.InternalModifiers); - MiraEventManager.OnLoadFinilize(); + MiraEventManager.OnLoadFinalize(); }; } @@ -143,7 +143,7 @@ public sealed class MiraPluginManager { if (plugin.ForceRegisterEvents) { - Warning("For optimisation reasons, MiraAPI no longer automatically searches every type for events. Please use RegisterEventsAttribute moving forward."); + Warning("For optimisation reasons, MiraAPI no longer automatically searches every type for events. Please use RegisterEventContainerAttribute moving forward."); } foreach (var type in assembly.GetTypes())