예제 #1
0
        public static void LoadAll()
        {
            GroupList = new List <Group>();
            if (File.Exists(Paths.RankPropsFile))
            {
                GroupProperties.InitAll();
            }
            else
            {
                // Add some default ranks
                Register(new Group(LevelPermission.Builder, 4096, 300, "Builder", '2'));            // 16^3 draw volume
                Register(new Group(LevelPermission.AdvBuilder, 262144, 900, "AdvBuilder", '3'));    // 64^3
                Register(new Group(LevelPermission.Operator, 2097152, 5400, "Operator", 'c'));      // 128^3
                Register(new Group(LevelPermission.Admin, 16777216, int.MaxValue, "SuperOP", 'e')); // 256^3
            }

            if (BannedRank == null)
            {
                Register(new Group(LevelPermission.Banned, 1, 1, "Banned", '8'));
            }
            if (GuestRank == null)
            {
                Register(new Group(LevelPermission.Guest, 1, 120, "Guest", '7'));
            }
            if (NobodyRank == null)
            {
                Register(new Group(LevelPermission.Nobody, 65536, int.MaxValue, "Nobody", '0'));
            }

            GroupList.Sort((a, b) => a.Permission.CompareTo(b.Permission));
            DefaultRank = Find(ServerConfig.DefaultRankName);
            if (DefaultRank == null)
            {
                DefaultRank = GuestRank;
            }

            OnGroupLoadEvent.Call();
            reloading = true;
            SaveAll(GroupList);

            Player.Console.group = NobodyRank;
            Player[] players = PlayerInfo.Online.Items;
            foreach (Player p in players)
            {
                p.group = Group.Find(p.group.Permission);
                if (p.group == null)
                {
                    p.group = DefaultRank;
                }
                if (PlayerDB.FindColor(p).Length > 0 || p.color == p.group.Color)
                {
                    continue;
                }

                p.color = p.group.Color;
                Entities.GlobalRespawn(p);
                p.SetPrefix();
            }
        }
예제 #2
0
파일: Player.cs 프로젝트: rdebath/MCGalaxy
        /// <summary> Calls SetColor, then updates state depending on color.
        /// (e.g. entity name, tab list name, prefix, etc) </summary>
        public void UpdateColor(string col)
        {
            string prevCol = color;

            SetColor(col);

            if (prevCol == color)
            {
                return;
            }
            Entities.GlobalRespawn(this);
            SetPrefix();
        }
예제 #3
0
        static void UpdateGroup(Player p)
        {
            Group grp = Group.Find(p.group.Permission);

            if (grp == null)
            {
                grp = DefaultRank;
            }
            p.group = grp;

            if (PlayerDB.FindColor(p).Length == 0 && p.color != grp.Color)
            {
                p.color = grp.Color;
                Entities.GlobalRespawn(p);
            }
            p.SetPrefix();
        }