Exemplo n.º 1
0
        static void SetMotd(Player p, Level lvl, string value)
        {
            lvl.Config.MOTD = value.Length == 0 ? "ignore" : value;
            lvl.ChatLevel("Map's MOTD was changed to: &b" + lvl.Config.MOTD);

            Player[] players = PlayerInfo.Online.Items;
            foreach (Player pl in players)
            {
                // Some clients will freeze or crash if we send a MOTD packet, but don't follow it up by a new map.
                // Although checking for CPE extension support is preferred, also send to whitelisted clients for maximum compatibility
                bool motdOnly = pl.Supports(CpeExt.InstantMOTD) || (pl.appName != null && pl.appName.CaselessStarts("classicalsharp"));
                if (motdOnly)
                {
                    pl.SendMapMotd();
                }
                else
                {
                    LevelActions.ReloadMap(p, pl, false);
                }
            }
        }
Exemplo n.º 2
0
        public static void UpdateFallback(bool global, byte block, Level level)
        {
            Player[] players = PlayerInfo.Online.Items;
            foreach (Player pl in players)
            {
                if (!global && pl.level != level)
                {
                    continue;
                }
                if (pl.hasBlockDefs)
                {
                    continue;
                }

                // if custom block is replacing core block, need to always reload for fallback
                if (block >= Block.CpeCount && !pl.level.MayHaveCustomBlocks)
                {
                    continue;
                }

                LevelActions.ReloadMap(pl, pl, false);
            }
        }