diff --git a/CommandHook/ChatCommandApiPatch.cs b/CommandHook/ChatCommandApiPatch.cs index a4e5b6e..1104723 100644 --- a/CommandHook/ChatCommandApiPatch.cs +++ b/CommandHook/ChatCommandApiPatch.cs @@ -25,7 +25,7 @@ public static class ChatCommandApiPatch return true; var sender = args.Caller.Player as IServerPlayer; - var data = new CommandData(sender, "/" + commandName); + var data = new CommandData(sender, commandName, "/" + commandName); if (system.FireBefore(commandName, ref data)) { diff --git a/CommandHook/CommandData.cs b/CommandHook/CommandData.cs index 348f4ee..b7b905c 100644 --- a/CommandHook/CommandData.cs +++ b/CommandHook/CommandData.cs @@ -19,11 +19,11 @@ public struct CommandData set => flags = value ? (byte)(flags | FlagCancel) : (byte)(flags & ~FlagCancel); } - public CommandData(IServerPlayer? sender, string fullCommand) + public CommandData(IServerPlayer? sender, string commandName, string fullCommand) { Sender = sender; - FullCommand = fullCommand.Length > 0 ? fullCommand.Trim() : string.Empty; - CommandName = FullCommand.Length > 1 ? FullCommand[1..].Split(' ')[0] : string.Empty; + CommandName = commandName; + FullCommand = fullCommand; flags = sender != null ? FlagIsPlayerCommand : (byte)0; } }