Esempio n. 1
0
        static void InitRest(SchedulerTask task)
        {
            IRC = new IRCBot();
            if (Server.Config.UseIRC)
            {
                IRC.Connect();
            }

            CountdownGame.Instance.AutoStart();
            ZSGame.Instance.AutoStart();
            LSGame.Instance.AutoStart();
            CTFGame.Instance.AutoStart();
            TWGame.Instance.AutoStart();

            MainScheduler.QueueRepeat(BlockQueue.Loop, null,
                                      TimeSpan.FromMilliseconds(BlockQueue.Interval));
            Critical.QueueRepeat(ServerTasks.TickPlayers, null,
                                 TimeSpan.FromMilliseconds(20));

            Logger.Log(LogType.SystemActivity, "Finished setting up server, finding classicube.net url..");
            SetupFinished = true;
        }
Esempio n. 2
0
        static void ShowAltsTask(SchedulerTask task)
        {
            string name = (string)task.State;
            Player p    = PlayerInfo.FindExact(name);

            if (p == null || p.Socket.Disconnected)
            {
                return;
            }

            // Server host is exempt from alt listing
            if (IPAddress.IsLoopback(p.IP))
            {
                return;
            }

            List <string> alts = PlayerInfo.FindAccounts(p.ip);

            // in older versions it was possible for your name to appear multiple times in DB
            while (alts.CaselessRemove(p.name))
            {
            }
            if (alts.Count == 0)
            {
                return;
            }

            ItemPerms opchat  = Chat.OpchatPerms;
            string    altsMsg = "λNICK &Sis lately known as: " + alts.Join();

            Chat.MessageFrom(p, altsMsg,
                             (pl, obj) => pl.CanSee(p) && opchat.UsableBy(pl.Rank));

            //IRCBot.Say(temp, true); //Tells people in op channel on IRC
            altsMsg = altsMsg.Replace("λNICK", name);
            Logger.Log(LogType.UserActivity, altsMsg);
        }
Esempio n. 3
0
        static void ShowAltsTask(SchedulerTask task)
        {
            string name = (string)task.State;
            Player p    = PlayerInfo.FindExact(name);

            if (p == null || p.ip == "127.0.0.1" || p.disconnected)
            {
                return;
            }

            List <string> alts = PlayerInfo.FindAccounts(p.ip);

            // Remove online accounts from the list of accounts on the IP
            for (int i = alts.Count - 1; i >= 0; i--)
            {
                if (PlayerInfo.FindExact(alts[i]) == null)
                {
                    continue;
                }
                alts.RemoveAt(i);
            }
            if (alts.Count == 0)
            {
                return;
            }

            LevelPermission adminChatRank = CommandOtherPerms.FindPerm("adminchat", LevelPermission.Admin);
            string          altsMsg       = p.ColoredName + " %Sis lately known as: " + alts.Join();

            if (p.group.Permission < adminChatRank || !Server.adminsjoinsilent)
            {
                Chat.MessageOps(altsMsg);
                //IRCBot.Say(temp, true); //Tells people in op channel on IRC
            }
            Server.s.Log(altsMsg);
        }
Esempio n. 4
0
 public override void Load(bool startup)
 {
     task = Server.MainScheduler.QueueRepeat(CheckDirection, null, TimeSpan.FromMilliseconds(100));
 }
Esempio n. 5
0
 void DoLotteryTick(SchedulerTask task)
 {
     DoLottery();
     Server.MainScheduler.Cancel(task);
 }
Esempio n. 6
0
 public static void UpdaterTask(SchedulerTask task)
 {
     UpdateCheck();
     task.Delay = TimeSpan.FromHours(2);
 }
Esempio n. 7
0
 static void LoadAllPlugins(SchedulerTask task)
 {
     Plugin.LoadAll();
 }
Esempio n. 8
0
 static void InitHeartbeat(SchedulerTask task)
 {
     Heartbeat.Start();
 }
Esempio n. 9
0
 void AllowMoreTntTask(SchedulerTask task)
 {
     CurrentAmountOfTnt--;
 }
Esempio n. 10
0
 /// <summary> Cancels a task if it is in the tasks list.
 /// <remarks> Does not cancel the task if it is currently executing. </remarks>
 public bool Cancel(SchedulerTask task)
 {
     lock (taskLock) {
         return(tasks.Remove(task));
     }
 }