Example #1
0
        static void Organize()
        {
            List <OnGroupSaveEvent> temp  = new List <OnGroupSaveEvent>();
            List <OnGroupSaveEvent> temp2 = events;
            OnGroupSaveEvent        temp3 = null;
            int i  = 0;
            int ii = temp2.Count;

            while (i < ii)
            {
                foreach (OnGroupSaveEvent p in temp2)
                {
                    if (temp3 == null)
                    {
                        temp3 = p;
                    }
                    else if (temp3.priority < p.priority)
                    {
                        temp3 = p;
                    }
                }
                temp.Add(temp3);
                temp2.Remove(temp3);
                temp3 = null;
                i++;
            }
            events = temp;
        }
Example #2
0
        /// <summary>
        /// Save givenList group
        /// </summary>
        /// <param name="givenList">The list of groups to save</param>
        public static void saveGroups(List <Group> givenList)
        {
            File.Create("properties/ranks.properties").Dispose();
            using (StreamWriter SW = File.CreateText("properties/ranks.properties")) {
                SW.WriteLine("#Version 3");
                SW.WriteLine("#RankName = string");
                SW.WriteLine("#     The name of the rank, use capitalization.");
                SW.WriteLine("#");
                SW.WriteLine("#Permission = num");
                SW.WriteLine("#     The \"permission\" of the rank. It's a number.");
                SW.WriteLine("#		There are pre-defined permissions already set. (for the old ranks)");
                SW.WriteLine("#		Banned = -20, Guest = 0, Builder = 30, AdvBuilder = 50, Operator = 80");
                SW.WriteLine("#		SuperOP = 100, Nobody = 120");
                SW.WriteLine("#		Must be greater than -50 and less than 120");
                SW.WriteLine("#		The higher the number, the more commands do (such as undo allowing more seconds)");
                SW.WriteLine("#Limit = num");
                SW.WriteLine("#     The command limit for the rank (can be changed in-game with /limit)");
                SW.WriteLine("#		Must be greater than 0 and less than 10000000");
                SW.WriteLine("#MaxUndo = num");
                SW.WriteLine("#     The undo limit for the rank, only applies when undoing others.");
                SW.WriteLine("#		Must be greater than 0 and less than "+ int.MaxValue);
                SW.WriteLine("#Color = char");
                SW.WriteLine("#     A single letter or number denoting the color of the rank");
                SW.WriteLine("#	    Possibilities:");
                SW.WriteLine("#		    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f");
                SW.WriteLine("#FileName = string.txt");
                SW.WriteLine("#     The file which players of this rank will be stored in");
                SW.WriteLine("#		It doesn't need to be a .txt file, but you may as well");
                SW.WriteLine("#		Generally a good idea to just use the same file name as the rank name");
                SW.WriteLine("#MOTD = string");
                SW.WriteLine("#		Alternate MOTD players of the rank will see when joining the server.");
                SW.WriteLine("#		Leave blank to use the server MOTD.");
                SW.WriteLine();
                SW.WriteLine();

                foreach (Group grp in givenList)
                {
                    if (grp.name != "nobody")
                    {
                        SW.WriteLine("RankName = " + grp.trueName);
                        SW.WriteLine("Permission = " + (int)grp.Permission);
                        SW.WriteLine("Limit = " + grp.maxBlocks);
                        SW.WriteLine("MaxUndo = " + grp.maxUndo);
                        SW.WriteLine("Color = " + grp.color[1]);
                        SW.WriteLine("MOTD = " + grp.MOTD);
                        SW.WriteLine("FileName = " + grp.fileName);
                        SW.WriteLine();
                    }
                }
            }
            if (OnGroupSave != null)
            {
                OnGroupSave();
            }
            OnGroupSaveEvent.Call();
        }