public static void InvokeCMD(NetworkUser user, string commandName, params string[] arguments) { var args = arguments.ToList(); var consoleUser = new Console.CmdSender(user); if (Console.instance) { RunCmdMethod.Invoke(Console.instance, new object [] { consoleUser, commandName, args }); } else { Log.Message("InvokeCMD called whilst no console instance exists.", LogLevel.Error, Log.Target.Bepinex); } }
private void Console_RunCmd(On.RoR2.Console.orig_RunCmd _, Console self, Console.CmdSender sender, string concommandName, System.Collections.Generic.List <string> userArgs) { if (concommandName == "say" && userArgs != null && userArgs.Count >= 1 && userArgs[0].StartsWith("/")) { var oldArgs = userArgs[0].Split(' '); concommandName = oldArgs[0].Substring(1); if (oldArgs.Length > 1) { userArgs[0] = string.Join(" ", oldArgs, 1, oldArgs.Length - 1); } else { userArgs[0] = ""; } } _origRunCmd(self, sender, concommandName, userArgs); }