diff --git a/CommandHook/CommandHookModSystem.cs b/CommandHook/CommandHookModSystem.cs index 130be33..a67dbef 100644 --- a/CommandHook/CommandHookModSystem.cs +++ b/CommandHook/CommandHookModSystem.cs @@ -12,7 +12,6 @@ public class CommandHookModSystem : ModSystem internal static CommandHookModSystem? Instance; private readonly List listeners = new(); - private readonly List wildcards = new(); private FrozenDictionary> registrations = FrozenDictionary>.Empty; @@ -38,7 +37,6 @@ public class CommandHookModSystem : ModSystem { harmony?.UnpatchAll(Mod.Info.ModID); listeners.Clear(); - wildcards.Clear(); Instance = null; } @@ -61,13 +59,11 @@ public class CommandHookModSystem : ModSystem return; listeners[i] = listener; - SyncWildcard(listener, commands); Rebuild(); return; } listeners.Add(listener); - SyncWildcard(listener, commands); } public void Unregister(ICommandHookListener listener) @@ -78,7 +74,6 @@ public class CommandHookModSystem : ModSystem continue; listeners.RemoveAt(i); - wildcards.RemoveAll(w => w.ModId == listener.ModId); Rebuild(); return; } @@ -94,10 +89,6 @@ public class CommandHookModSystem : ModSystem if (commands == null || commands.Count == 0) continue; - bool isWildcard = commands.Count == 1 && commands[0] == "*"; - if (isWildcard) - continue; - foreach (var cmd in commands) { if (!builder.TryGetValue(cmd, out var mods)) @@ -109,10 +100,6 @@ public class CommandHookModSystem : ModSystem } } - foreach (var wildcard in wildcards) - foreach (var mods in builder.Values) - mods[wildcard.ModId] = wildcard.Registration; - var pruned = new Dictionary>( builder.Count ); @@ -164,14 +151,6 @@ public class CommandHookModSystem : ModSystem } } - private void SyncWildcard(ICommandHookListener listener, IReadOnlyList commands) - { - bool isWildcard = commands.Count == 1 && commands[0] == "*"; - wildcards.RemoveAll(w => w.ModId == listener.ModId); - if (isWildcard) - wildcards.Add(listener); - } - private static bool CommandListEquals(IReadOnlyList a, IReadOnlyList b) { if (a.Count != b.Count)