RankSystem.RankSystem.OnInitialize C# (CSharp) Method

OnInitialize() public method

public OnInitialize ( ) : void
return void
        public void OnInitialize()
        {
            SetupConfig();
            for (int i = 0; i < RankConfig.Ranks.Length; i++ )
            {
                for(int j= 0 ; j <RankConfig.Ranks[i].Length;j++)
                    if (!TShock.Groups.GroupExists(RankConfig.Ranks[i][j]))
                        TShock.Groups.AddGroup(RankConfig.Ranks[i][j], RankConfig.RankPermissions[i][j]);
            }
            Commands.ChatCommands.Add(new Command("pouch", Rank, "rank"));
            Commands.ChatCommands.Add(new Command("changerank", ChRank, "chrank"));
            SQLEditor = new SqlTableEditor(TShock.DB, TShock.DB.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder)new SqliteQueryCreator() : new MysqlQueryCreator());
            SQLWriter = new SqlTableCreator(TShock.DB, TShock.DB.GetSqlType() == SqlType.Sqlite ? (IQueryBuilder)new SqliteQueryCreator() : new MysqlQueryCreator());
            bool dontchangemyrank = false;
            bool changerank = false;
            foreach (Group group in TShock.Groups.groups)
            {
                if (group.Name != "superadmin")
                {
                    if (group.HasPermission("dontchangemyrank"))
                        dontchangemyrank = true;
                    if (group.HasPermission("chrank"))
                        changerank = true;
                }
            }

            List<string> permlist = new List<string>();
            if (!dontchangemyrank)
                permlist.Add("dontchangemyrank");
            if (!changerank)
                permlist.Add("chrank");
            TShock.Groups.AddPermissions("trustedadmin", permlist);
        }