static void Organize() { List <OnGroupLoadedEvent> temp = new List <OnGroupLoadedEvent>(); List <OnGroupLoadedEvent> temp2 = events; OnGroupLoadedEvent temp3 = null; int i = 0; int ii = temp2.Count; while (i < ii) { foreach (OnGroupLoadedEvent 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; }
/// <summary> /// Create a new group object /// </summary> /// <param name="Perm">The permission of the group</param> /// <param name="maxB">The maxblocks this group can cuboid</param> /// <param name="maxUn">The max undo this group can do</param> /// <param name="fullName">The group full name</param> /// <param name="newColor">The color of the group (Not including the &)</param> /// <param name="motd">the custom MOTD for the group</param> /// <param name="file">The file path where the current players of this group are stored</param> public Group(LevelPermission Perm, int maxB, long maxUn, string fullName, char newColor, string motd, string file) { Permission = Perm; maxBlocks = maxB; maxUndo = maxUn; trueName = fullName; name = trueName.ToLower(); color = "&" + newColor; MOTD = motd; fileName = file; playerList = name != "nobody" ? PlayerList.Load(fileName, this) : new PlayerList(); if (OnGroupLoaded != null) { OnGroupLoaded(this); } OnGroupLoadedEvent.Call(this); }