Esempio n. 1
0
        void GetPlugs(BasePlayer player)
        {
            var path = ActiveAdmins[player.userID];

            PlugList.Clear();
            path.noOfPlugs = 0;
            List <string> sortedPlugs = new List <string>();

            foreach (var entry in plugins.GetAll())
            {
                if (entry.IsCorePlugin)
                {
                    continue;
                }

                var str           = entry.ToString();
                var charsToRemove = new string[] { "Oxide.Plugins." };
                foreach (var c in charsToRemove)
                {
                    str = str.Replace(c, string.Empty).ToLower();
                }

                foreach (var perm in permission.GetPermissions().ToList())
                {
                    if (perm.Contains($"{str}") && !(BlockList.Split(',').ToList().Contains($"{str}")))
                    {
                        path.exists = false;

                        foreach (var livePlug in sortedPlugs)
                        {
                            if (livePlug == str)
                            {
                                path.exists = true; //prevent duplicates entries
                            }
                        }
                        if (!path.exists)
                        {
                            sortedPlugs.Add(str);// add to list for sorting
                        }
                    }
                }
            }
            sortedPlugs.Sort();
            foreach (var entry in sortedPlugs) //bring from sorted list to numbered dictionary
            {
                path.noOfPlugs++;
                PlugList.Add(path.noOfPlugs, entry);
            }
        }