private void UnregisterRocketCommands(bool silent = false) { var _rocketCommands = AccessorFactory.AccessField <List <RocketCommandManager.RegisteredRocketCommand> >(R.Commands, "commands").Value; if (_rocketCommands == null) { Logger.LogError("Could not unregister Rocket commands."); return; } /* All names & aliases of uEssentials command */ var essCommands = _rocketCommands .Where(c => c.Command is CommandAdapter) .Select(c => c.Name.ToLowerInvariant()) .ToList(); _rocketCommands.RemoveAll(c => { if (essCommands.Contains(c.Name.ToLowerInvariant()) && !(c.Command is CommandAdapter)) { if (!silent) { Logger.LogInfo($"Overriding Rocket command ({c.Name.ToLowerInvariant()})"); } return(true); } return(false); }); }
internal CommandManager() { CommandMap = new Dictionary <string, ICommand>(); _rocketCommands = AccessorFactory.AccessField <List <RocketCommandManager.RegisteredRocketCommand> >(R.Commands, "commands").Value; }