Пример #1
0
        static bool ChangeMap(Player p, Level lvl, string name)
        {
            if (Interlocked.CompareExchange(ref p.UsingGoto, 1, 0) == 1)
            {
                p.Message("Cannot use /goto, already joining a map.");
                return(false);
            }
            Level oldLevel = p.level;
            bool  didJoin  = false;

            try {
                MCGalaxy.Commands.Misc.CmdTp.SavePreTeleportState(p);
                didJoin = name == null?GotoLevel(p, lvl) : GotoMap(p, name);
            } finally {
                Interlocked.Exchange(ref p.UsingGoto, 0);
                Server.DoGC();
            }

            if (!didJoin)
            {
                return(false);
            }
            oldLevel.AutoUnload();
            return(true);
        }
Пример #2
0
        public static void SetMainLevel(Level lvl)
        {
            Level oldMain = mainLevel;

            mainLevel = lvl;
            Server.Config.MainLevel = lvl.name;
            oldMain.AutoUnload();
        }