Ejemplo n.º 1
0
 public static void ReloadAll(Level lvl, Player src, bool announce)
 {
     Player[] players = PlayerInfo.Online.Items;
     foreach (Player p in players)
     {
         if (p.level != lvl)
         {
             continue;
         }
         LevelActions.ReloadFor(src, p, true);
     }
 }
Ejemplo n.º 2
0
        static void SetMotd(Player p, Level lvl, string value)
        {
            lvl.Config.MOTD = value.Length == 0 ? "ignore" : value;
            lvl.Message("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.ReloadFor(p, pl, false);
                }
            }
        }
Ejemplo n.º 3
0
        public static void UpdateFallback(bool global, BlockID 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.ReloadFor(pl, pl, false);
            }
        }