diff --git a/CommandHook/CommandHookModSystem.cs b/CommandHook/CommandHookModSystem.cs index 4a27dd8..ee81399 100644 --- a/CommandHook/CommandHookModSystem.cs +++ b/CommandHook/CommandHookModSystem.cs @@ -7,7 +7,7 @@ namespace CommandHook; public class CommandHookModSystem : ModSystem { - private readonly Dictionary wildcards = new(); + private readonly Dictionary wildcards = new(); private readonly Dictionary registrations = new(); public override bool ShouldLoad(EnumAppSide forSide) => forSide == EnumAppSide.Server; @@ -18,12 +18,12 @@ public class CommandHookModSystem : ModSystem api.Event.PlayerChat += OnPlayerChat; } - public void RegisterWildcard(string modId, WildcardModRegistration registration) + public void RegisterWildcard(string modId, CommandRegistration registration) { wildcards[modId] = registration; } - public void Register(string modId, CommandRegistration registration) + public void Register(string modId, string command, CommandRegistration registration) { if (!registrations.TryGetValue(modId, out var modReg)) { @@ -31,7 +31,7 @@ public class CommandHookModSystem : ModSystem registrations[modId] = modReg; } - modReg.Commands[registration.CommandFilter] = registration; + modReg.Commands[command] = registration; } private void OnPlayerChat( diff --git a/CommandHook/CommandRegistration.cs b/CommandHook/CommandRegistration.cs index 416a225..37bb7f5 100644 --- a/CommandHook/CommandRegistration.cs +++ b/CommandHook/CommandRegistration.cs @@ -2,17 +2,11 @@ namespace CommandHook; public struct CommandRegistration { - public readonly string CommandFilter; public readonly CommandHookDelegate? Before; public readonly CommandHookDelegate? After; - public CommandRegistration( - string commandFilter, - CommandHookDelegate? before, - CommandHookDelegate? after - ) + public CommandRegistration(CommandHookDelegate? before, CommandHookDelegate? after) { - CommandFilter = commandFilter; Before = before; After = after; } diff --git a/CommandHook/WildcardModRegistration.cs b/CommandHook/WildcardModRegistration.cs deleted file mode 100644 index e83bd79..0000000 --- a/CommandHook/WildcardModRegistration.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace CommandHook; - -public struct WildcardModRegistration -{ - public readonly CommandHookDelegate? Before; - public readonly CommandHookDelegate? After; - - public WildcardModRegistration(CommandHookDelegate? before, CommandHookDelegate? after) - { - Before = before; - After = after; - } -}