Example #1
0
        public static void UpdateRegion(Client player)
        {
            var w = player.Session.CurrentRegion;

            if (w == null)
            {
                player.Score = null;
                return;
            }

            if (player.Settings.ShowRegionScoreboard == false)
            {
                return;
            }

            var score = new Scoreboard("region", w.ColorName, ScreenPosition.Sidebar);

            score.Add(Chat.Italic + w.ColorType, 99);
            //score.Add(Chat.Gray + Chat.Underline + Chat.Bold + "Residents", w.ResidentCount);
            int n = 0;

            foreach (var p in w.Residents.ToArray())
            {
                if (p == player.MinecraftUsername)
                {
                    score.Add(p, 1);
                }
                else
                {
                    score.Add(Chat.Gray + p, 1);
                }
                n++;
                if (n >= 10)
                {
                    break;
                }
            }

            player.Score = score;
        }
        private bool MergeBlocks(BoardSlot from, BoardSlot to, bool onlySimulate)
        {
            if (from.GetBlock().Value == to.GetBlock().Value)
            {
                if (!onlySimulate)
                {
                    int newValue = from.GetBlock().Value * 2;
                    Board.ReplaceBlock(to, new Block(newValue));
                    Board.RemoveBlock(from);

                    Score.Add(newValue);
                }

                return(true);
            }

            return(false);
        }