bool FindTokenCommand(string prefix, out CommandInfo info)
        {
            info = null;

            foreach (var plugin in PluginManager.EnumeratePlugins)
            {
                lock (plugin.commands)
                {
                    if (plugin.IsEnabled && plugin.commands.TryGetValue(prefix, out info) && (info.tokenCallback != null || info.LuaCallback != null))
                        return true;
                }
            }

            if (serverCommands.TryGetValue(prefix, out info) && info.tokenCallback != null)
                return true;

            return false;
        }
        bool FindStringCommand(string prefix, out CommandInfo info)
        {
            info = null;

            foreach (var plugin in PluginManager.EnumeratePlugins)
            {
                lock (plugin.commands)
                {
                    //if (plugin.IsEnabled && plugin.commands.TryGetValue(prefix, out info) && info.stringCallback != null)
                    if (plugin.IsEnabled && plugin.commands.TryGetValue(prefix, out info))
                    {
                        return info.stringCallback != null;
                    }
                }
            }

            if (serverCommands.TryGetValue(prefix, out info) && info.stringCallback != null)
                return true;

            return false;
        }
        //        /// <summary>
        //        /// Reads active permission nodes, Player only.
        //        /// </summary>
        //        public void ReadPermissionNodes()
        //        {
        //            foreach (CommandInfo info in serverCommands.Values)
        //            {
        //                if (info.accessLevel == AccessLevel.PLAYER)
        //                {
        //                    if (info.node.Trim().Length > 0 && !Program.permissionManager.ActiveNodes.Contains(info.node))
        //                        Program.permissionManager.ActiveNodes.Add(info.node);
        //                }
        //            }
        //        }
        /// <summary>
        /// Registers new command
        /// </summary>
        /// <param name="prefix">The text attached to the / that will be registered as the command.</param>
        /// <returns>CommandInfo for new command</returns>
        public CommandInfo AddCommand(string prefix)
        {
            if (serverCommands.ContainsKey(prefix)) throw new ApplicationException("AddCommand: duplicate command: " + prefix);

            var cmd = new CommandInfo(prefix);
            serverCommands[prefix] = cmd;
            serverCommands["." + prefix] = cmd;

            return cmd;
        }
        /// <summary>
        /// Permissions checking for registered commands.
        /// </summary>
        /// <param name="sender">Entity to check permissions for</param>
        /// <param name="cmd">Command to check for permissions on</param>
        /// <returns>True if entity can use command.  False if not.</returns>
        public static Permissions.Permission CheckPermissions(ISender sender, CommandInfo cmd)
        {
            /*
             *  [TODO] Should a node return false, Since there is three possibilites, should it return false if permissions
             *  is enabled and allow the normal OP system work or no access at all?
             */
            if (cmd.node == null || sender is ConsoleSender || sender.Op)
                return Permissions.Permission.Permitted;

            if (sender is BasePlayer && Permissions.PermissionsManager.IsSet)
                return Permissions.PermissionsManager.IsPermitted(cmd.node, sender as BasePlayer);

            return Permissions.Permission.Denied;
        }
        /// <summary>
        /// Determines entity's ability to use command. Used when permissions plugin is running.
        /// </summary>
        /// <param name="cmd">Command to check</param>
        /// <param name="sender">Sender entity to check against</param>
        /// <returns>True if sender can use command, false if not</returns>
        public static bool CheckAccessLevel(CommandInfo cmd, ISender sender)
        {
            var perms = CheckPermissions(sender, cmd);
            if (Permissions.PermissionsManager.IsSet && perms == Permissions.Permission.Denied)
                return false;

            return CheckAccessLevel(cmd.accessLevel, sender);
        }
 internal void InitFrom(CommandInfo other)
 {
     description = other.description;
     helpText = other.helpText;
     accessLevel = other.accessLevel;
     tokenCallback = other.tokenCallback;
     stringCallback = other.stringCallback;
     LuaCallback = other.LuaCallback;
     ClearEvents();
 }