示例#1
0
        void Listener_OnPublic(UserInfo user, string channel, string message)
        {
            //string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";
            // Allowed chars are any ASCII char between 20h/32 and 7Ah/122 inclusive, except for 26h/38 (&) and 60h/96 (`)

            for (byte i = 10; i < 16; i++)
            {
                message = message.Replace(ColorSignal + i, c.IRCtoMC(i).Replace('&', '%'));
            }
            for (byte i = 0; i < 10; i++)
            {
                message = message.Replace(ColorSignal + i, c.IRCtoMC(i).Replace('&', '%'));
            }

            message = message.MCCharFilter();
            if (Player.MessageHasBadColorCodes(null, message))
            {
                return;
            }
            if (channel == opchannel)
            {
                Server.s.Log(String.Format("(OPs): [IRC] {0}: {1}", user.Nick, message));
                Player.GlobalMessageOps(String.Format("To Ops &f-{0}[IRC] {1}&f- {2}", Server.IRCColour, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message));
            }
            else
            {
                Server.s.Log(String.Format("[IRC] {0}: {1}", user.Nick, message));
                Player.GlobalMessage(String.Format("{0}[IRC] {1}: &f{2}", Server.IRCColour, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message));
            }
        }
示例#2
0
        // On public channel message
        void OnChanMessage(object sender, IrcEventArgs e)
        {
            string temp = e.Data.Message; string storedNick = e.Data.Nick;

            string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";

            foreach (char ch in temp)
            {
                if (allowedchars.IndexOf(ch) == -1)
                {
                    temp = temp.Replace(ch.ToString(), "*");
                }
            }

            if (e.Data.Channel == opchannel)
            {
                Server.s.Log("[(Op) IRC] " + e.Data.Nick + ": " + temp);
                Player.GlobalMessageOps(Server.IRCColour + "[(Op) IRC] " + storedNick + ": &f" + temp);
            }
            else
            {
                Server.s.Log("[IRC] " + e.Data.Nick + ": " + temp);
                Player.GlobalChat(null, Server.IRCColour + "[IRC] " + storedNick + ": &f" + temp, false);
            }

            //if (temp.IndexOf(':') < temp.IndexOf(' ')) {
            //    storedNick = temp.Substring(0, temp.IndexOf(':'));
            //    temp = temp.Substring(temp.IndexOf(' ') + 1);
            //}

            //s.Log("IRC: " + e.Data.Nick + ": " + e.Data.Message);
            //Player.GlobalMessage("IRC: &1" + e.Data.Nick + ": &f" + e.Data.Message);
        }
示例#3
0
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Help(p); return;
     }
     Player.SendMessage(p, "You requested that operators see your building. They should be coming soon.");
     Player.GlobalMessageOps(p.color + p.name + "-" + Server.DefaultColor + " requests a review of their building");
 }
示例#4
0
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Help(p); return;
     }
     Player.GlobalMessageOps(p.color + Server.DefaultColor + " used &b/crashserver");
     p.Kick("Server crash! Error code 0x0005A4");
 }
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Help(p); return;
     }
     Player.GlobalMessageOps(p.color + Server.DefaultColor + " used &b/crashserver");
     p.Kick("Server crash! Error code 0x" + Convert.ToString(p.random.Next(int.MinValue, int.MaxValue), 16).ToUpper());
 }
示例#6
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            bool stealth = false;

            if (message[0] == '#')
            {
                message = message.Remove(0, 1).Trim();
                stealth = true;
                Server.s.Log("Stealth joker attempted");
            }

            Player who = Player.Find(message);

            if (who == null)
            {
                Player.SendMessage(p, "Could not find player.");
                return;
            }
            if (p != null && who.group.Permission > p.group.Permission)
            {
                Player.SendMessage(p, "Cannot joker someone of equal or greater rank."); return;
            }

            if (!who.joker)
            {
                who.joker = true;
                if (stealth)
                {
                    Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " is now STEALTH joker'd. "); return;
                }
                Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " is now a &aJ&bo&ck&5e&9r" + Server.DefaultColor + ".", false);
            }
            else
            {
                who.joker = false;
                if (stealth)
                {
                    Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " is now STEALTH Unjoker'd. "); return;
                }
                Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " is no longer a &aJ&bo&ck&5e&9r" + Server.DefaultColor + ".", false);
            }
        }
示例#7
0
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                Help(p); return;
            }
            if (p.possess != "")
            {
                Player.SendMessage(p, "Stop your current possession first.");
                return;
            }
            Command opchat = Command.all.Find("opchat");

            p.hidden = !p.hidden;
            if (p.hidden)
            {
                Player.GlobalDie(p, true);
                Player.GlobalMessageOps("To Ops -" + p.color + p.name + "-" + Server.DefaultColor + " is now &finvisible" + Server.DefaultColor + ".");
                Player.GlobalChat(p, "&c- " + p.color + p.prefix + p.name + Server.DefaultColor + " disconnected.", false);
                if (p.opchat == false)
                {
                    opchat.Use(p, message);
                }
                else
                {
                }
                //Player.SendMessage(p, "You're now &finvisible&e.");
            }
            else
            {
                Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                Player.GlobalMessageOps("To Ops -" + p.color + p.name + "-" + Server.DefaultColor + " is now &8visible" + Server.DefaultColor + ".");
                Player.GlobalChat(p, "&a+ " + p.color + p.prefix + p.name + Server.DefaultColor + " joined the game.", false);
                if (p.opchat == true)
                {
                    opchat.Use(p, message);
                }
                else
                {
                }
                //Player.SendMessage(p, "You're now &8visible&e.");
            }
        }
示例#8
0
        public override void Use(Player p, string message)
        {
            CatchPos cpos;

            if (message == "")
            {
                p.ZoneCheck = true;
                Player.SendMessage(p, "Place a block where you would like to check for zones.");
                return;
            }
            else if (p.group.Permission < LevelPermission.Operator)
            {
                Player.SendMessage(p, "Reserved for OP+");
                return;
            }

            if (message.IndexOf(' ') == -1)
            {
                if (p.canBuild == true)        //Checks if player can build there
                {
                    switch (message.ToLower()) //If true - they can delete the zone
                    {
                    case "del":
                        p.zoneDel = true;
                        Player.SendMessage(p, "Place a block where you would like to delete a zone.");
                        return;

                    default:
                        Help(p);
                        return;
                    }
                }
                else //if they cant, it warns them, the ops and logs it on the server!
                {
                    Player.SendMessage(p, "You can't delete a zone which is above your rank!");
                    Player.GlobalMessageOps(p.name + " tried to delete a zone that is above their rank!");
                    Server.s.Log(p.name + " tried to delete a zone that is above their rank!");
                    return;
                }
            }


            if (message.ToLower() == "del all")
            {
                if (p.group.Permission < LevelPermission.Admin)
                {
                    Player.SendMessage(p, "Only a SuperOP may delete all zones at once");
                    return;
                }
                else
                {
                    for (int i = 0; i < p.level.ZoneList.Count; i++)
                    {
                        Level.Zone Zn = p.level.ZoneList[i];
                        MySQL.executeQuery("DELETE FROM `Zone" + p.level.name + "` WHERE Owner='" + Zn.Owner + "' AND SmallX='" + Zn.smallX + "' AND SMALLY='" + Zn.smallY + "' AND SMALLZ='" + Zn.smallZ + "' AND BIGX='" + Zn.bigX + "' AND BIGY='" + Zn.bigY + "' AND BIGZ='" + Zn.bigZ + "'");

                        Player.SendMessage(p, "Zone deleted for &b" + Zn.Owner);
                        p.level.ZoneList.Remove(p.level.ZoneList[i]);
                        if (i == p.level.ZoneList.Count)
                        {
                            Player.SendMessage(p, "Finished removing all zones"); return;
                        }
                        i--;
                    }
                }
            }


            if (p.group.Permission < LevelPermission.Operator)
            {
                Player.SendMessage(p, "Setting zones is reserved for OP+"); return;
            }

            if (Group.Find(message.Split(' ')[1]) != null)
            {
                message = message.Split(' ')[0] + " grp" + Group.Find(message.Split(' ')[1]).name;
            }

            if (message.Split(' ')[0].ToLower() == "add")
            {
                Player foundPlayer = Player.Find(message.Split(' ')[1]);
                if (foundPlayer == null)
                {
                    cpos.Owner = message.Split(' ')[1].ToString();
                }
                else
                {
                    cpos.Owner = foundPlayer.name;
                }
            }
            else
            {
                Help(p); return;
            }

            if (!Player.ValidName(cpos.Owner))
            {
                Player.SendMessage(p, "INVALID NAME."); return;
            }

            cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;

            Player.SendMessage(p, "Place two blocks to determine the edges.");
            Player.SendMessage(p, "Zone for: &b" + cpos.Owner + ".");
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
示例#9
0
        public override void Use(Player p, string message)
        {
            if (message.ToLower() == "superops" || message.ToLower() == "ops" || message.ToLower() == "advbuilders" || message.ToLower() == "builders")
            {
                p.SendMessage("You cannot try to promote yourself with /text! You have been reported to all Ops!");
                Player.GlobalMessageOps(p.color + p.name + Server.DefaultColor + " tried to promote theirself by using /text!!");
                Server.s.Log(p.name + " tried to promote themselves using /text!!");
                return;
            }

            // Create the directory if it doesn't exist
            if (!Directory.Exists("extra/text/"))
            {
                Directory.CreateDirectory("extra/text");
            }

            // Show the help if the message doesn't contain enough parameters
            if (message.IndexOf(' ') == -1)
            {
                Help(p);
                return;
            }

            string[] param = message.Split(' ');

            try
            {
                if (param[0].ToLower() == "delete")
                {
                    string filename = SanitizeFileName(param[1]) + ".txt";
                    if (File.Exists("extra/text/" + filename))
                    {
                        File.Delete("extra/text/" + filename);
                        p.SendMessage("Deleted file: " + filename);
                        return;
                    }
                    else
                    {
                        p.SendMessage("Could not find file: " + filename);
                        return;
                    }
                }
                else
                {
                    bool   again    = false;
                    string filename = SanitizeFileName(param[0]) + ".txt";
                    string path     = "extra/text/" + filename;

                    // See if we match the group
                    string group = Group.findPerm(LevelPermission.Guest).name;
                    if (Group.Find(param[1]) != null)
                    {
                        group = Group.Find(param[1]).name;
                        again = true;
                    }

                    message = message.Substring(message.IndexOf(' ') + 1);
                    if (again)
                    {
                        message = message.Substring(message.IndexOf(' ') + 1);
                    }

                    string contents = message;
                    if (contents == "")
                    {
                        Help(p);
                        return;
                    }

                    if (!File.Exists(path))
                    {
                        contents = "#" + group + System.Environment.NewLine + contents;
                    }
                    else
                    {
                        contents = " " + contents;
                    }

                    File.AppendAllText(path, contents);
                    p.SendMessage("Added text to: " + filename);
                }
            } catch { Help(p); }
        }
示例#10
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            int pos = message.IndexOf(' ');

            if (pos != -1)
            {
                string action = message.Substring(0, pos);
                string player = message.Substring(pos + 1);

                switch (action)
                {
                case "add":
                    if (Server.whiteList.Contains(player))
                    {
                        Player.SendMessage(p, "&f" + player + Server.DefaultColor + " is already on the whitelist!");
                        break;
                    }
                    Server.whiteList.Add(player);
                    Player.GlobalMessageOps(p.color + p.prefix + p.name + Server.DefaultColor + " added &f" + player + Server.DefaultColor + " to the whitelist.");
                    Server.whiteList.Save("whitelist.txt");
                    Server.s.Log("WHITELIST: Added " + player);
                    break;

                case "del":
                    if (!Server.whiteList.Contains(player))
                    {
                        Player.SendMessage(p, "&f" + player + Server.DefaultColor + " is not on the whitelist!");
                        break;
                    }
                    Server.whiteList.Remove(player);
                    Player.GlobalMessageOps(p.color + p.prefix + p.name + Server.DefaultColor + " removed &f" + player + Server.DefaultColor + " from the whitelist.");
                    Server.whiteList.Save("whitelist.txt");
                    Server.s.Log("WHITELIST: Removed " + player);
                    break;

                case "list":
                    string output = "Whitelist:&f";
                    foreach (string wlName in Server.whiteList.All())
                    {
                        output += " " + wlName + ",";
                    }
                    output = output.Substring(0, output.Length - 1);
                    Player.SendMessage(p, output);
                    break;

                default:
                    Help(p);
                    return;
                }
            }
            else
            {
                if (message == "list")
                {
                    string output = "Whitelist:&f";
                    foreach (string wlName in Server.whiteList.All())
                    {
                        output += " " + wlName + ",";
                    }
                    output = output.Substring(0, output.Length - 1);
                    Player.SendMessage(p, output);
                }
                else
                {
                    Help(p);
                }
            }
        }
示例#11
0
        //During Game Main Methods
        public void Start()
        {
            GameStatus = TntWarsGameStatus.AboutToStart;
            //Checking Backups & physics etc.
            {
                BackupNumber = lvl.Backup(true);
                if (BackupNumber <= 0)
                {
                    SendAllPlayersMessage(c.red + "Backing up Level for TNT Wars failed, Stopping game");
                    Player.GlobalMessageOps(c.red + "Backing up Level for TNT Wars failed, Stopping game");
                    GameStatus = TntWarsGameStatus.Finished;
                    return;
                }
                Server.s.Log("Backed up " + lvl.name + " (" + BackupNumber.ToString() + ") for TNT Wars");
            }
            //Map stuff
            lvl.setPhysics(3);
            lvl.permissionbuild = Group.Find(Server.defaultRank).Permission;
            lvl.permissionvisit = Group.Find(Server.defaultRank).Permission;
            lvl.Killer          = true;
            //Seting Up Some Player stuff
            {
                foreach (player p in Players)
                {
                    p.p.PlayingTntWars       = true;
                    p.p.CurrentAmountOfTnt   = 0;
                    p.p.CurrentTntGameNumber = GameNumber;
                    if (GameDifficulty == TntWarsDifficulty.Easy || GameDifficulty == TntWarsDifficulty.Normal)
                    {
                        p.p.TntWarsHealth = 2;
                    }
                    else
                    {
                        p.p.TntWarsHealth = 1;
                    }
                    p.p.HarmedBy = null;
                    if (GracePeriod)
                    {
                        p.p.canBuild = false;
                    }
                    if (p.spec)
                    {
                        p.p.canBuild = false;
                        Player.SendMessage(p.p, "TNT Wars: Disabled building because you are a spectator!");
                    }
                    p.p.TntWarsKillStreak              = 0;
                    p.p.TntWarsScoreMultiplier         = 1f;
                    p.p.TNTWarsLastKillStreakAnnounced = 0;
                    SetTitlesAndColor(p);
                }
                if (GracePeriod)
                {
                    SendAllPlayersMessage("TNT Wars: Disabled building during Grace Period!");
                }
            }
            //Spawn them (And if needed, move them to the correct level!)
            {
                foreach (player p in Players.Where(p => p.p.level != lvl))
                {
                    Command.all.Find("goto").Use(p.p, lvl.name);
                    while (p.p.Loading)
                    {
                        Thread.Sleep(250);
                    }
                    p.p.inTNTwarsMap = true;
                }
                if (GameMode == TntWarsGameMode.TDM)
                {
                    Command.all.Find("reveal").Use(null, "all " + lvl.name);
                }                                                                                                //So peoples names apear above their heads in the right color!
                foreach (player p in Players)
                {
                    Command.all.Find("spawn").Use(p.p, ""); //This has to be after reveal so that they spawn in the correct place!!
                    Thread.Sleep(250);
                }
            }
            //Announcing Etc.
            string Gamemode = "Free For All";

            if (GameMode == TntWarsGameMode.TDM)
            {
                Gamemode = "Team Deathmatch";
            }
            string Difficulty    = "Normal";
            string HitsToDie     = "2";
            string explosiontime = "medium";
            string explosionsize = "normal";

            switch (GameDifficulty)
            {
            case TntWarsDifficulty.Easy:
                Difficulty    = "Easy";
                explosiontime = "long";
                break;

            case TntWarsDifficulty.Normal:
                Difficulty = "Normal";
                break;

            case TntWarsDifficulty.Hard:
                HitsToDie  = "1";
                Difficulty = "Hard";
                break;

            case TntWarsDifficulty.Extreme:
                HitsToDie     = "1";
                explosiontime = "short";
                explosionsize = "big";
                Difficulty    = "Extreme";
                break;
            }
            string teamkillling = "Disabled";

            if (TeamKills)
            {
                teamkillling = "Enabled";
            }
            Player.GlobalMessage(c.red + "TNT Wars " + Server.DefaultColor + "on '" + lvl.name + "' has started " + c.teal + Gamemode + Server.DefaultColor + " with a difficulty of " + c.teal + Difficulty + Server.DefaultColor + " (" + c.teal + HitsToDie + Server.DefaultColor + " hits to die, a " + c.teal + explosiontime + Server.DefaultColor + " explosion delay and with a " + c.teal + explosionsize + Server.DefaultColor + " explosion size)" + ", team killing is " + c.teal + teamkillling + Server.DefaultColor + " and you can place " + c.teal + TntPerPlayerAtATime.ToString() + Server.DefaultColor + " TNT at a time and there is a score limit of " + c.teal + ScoreLimit.ToString() + Server.DefaultColor + "!!");
            if (GameMode == TntWarsGameMode.TDM)
            {
                SendAllPlayersMessage("TNT Wars: Start your message with ':' to send it as a team chat!");
            }
            //GracePeriod
            if (GracePeriod) //Check This Grace Stuff
            {
                GameStatus = TntWarsGameStatus.GracePeriod;
                int GracePeriodSecsRemaining = GracePeriodSecs;
                SendAllPlayersMessage("TNT Wars: Grace Period of " + c.lime + GracePeriodSecsRemaining.ToString() + Server.DefaultColor + " seconds");
                while (GracePeriodSecsRemaining > 0)
                {
                    switch (GracePeriodSecsRemaining)
                    {
                    case 300:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "5" + Server.DefaultColor + " minutes remaining!");
                        break;

                    case 240:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "4" + Server.DefaultColor + " minutes remaining!");
                        break;

                    case 180:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "3" + Server.DefaultColor + " minutes remaining!");
                        break;

                    case 120:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "2" + Server.DefaultColor + " minutes remaining!");
                        break;

                    case 90:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "1" + Server.DefaultColor + " minute and " + c.teal + "30" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 60:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "1" + Server.DefaultColor + " minute remaining!");
                        break;

                    case 45:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "45" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 30:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "30" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 15:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "15" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 10:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "10" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 9:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "9" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 8:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "8" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 7:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "7" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 6:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "6" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 5:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "5" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 4:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "4" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 3:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "3" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 2:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "2" + Server.DefaultColor + " seconds remaining!");
                        break;

                    case 1:
                        SendAllPlayersMessage("TNT Wars: " + c.teal + "1" + Server.DefaultColor + " second remaining!");
                        break;
                    }

                    Thread.Sleep(1000);
                    GracePeriodSecsRemaining -= 1;
                }
                SendAllPlayersMessage("TNT Wars: Grace Period is over!!!!!");
                SendAllPlayersMessage("TNT Wars: You may now place " + c.red + "TNT");
            }
            SendAllPlayersMessage("TNT Wars: " + c.white + "The Game Has Started!!!!!");
            GameStatus = TntWarsGameStatus.InProgress;
            foreach (player p in Players)
            {
                if (p.spec == false)
                {
                    p.p.canBuild = true;
                }
            }
            if (GracePeriod)
            {
                SendAllPlayersMessage("TNT Wars: You can now build!!");
            }
            //MainLoop
            while (!Finished())
            {
                int i = 1; //For making a top 5 (or whatever) players announcement every 3 loops (if TDM)
                Thread.Sleep(3 * 1000); if (Finished())
                {
                    break;                                      //--\\
                }
                Thread.Sleep(3 * 1000); if (Finished())
                {
                    break;                                      //----\
                }
                Thread.Sleep(3 * 1000); if (Finished())
                {
                    break;                                      //-----> So that if it finsihes, we don't have to wait like 10 secs for the announcement!!
                }
                Thread.Sleep(3 * 1000); if (Finished())
                {
                    break;                                      //----/
                }
                Thread.Sleep(3 * 1000); if (Finished())
                {
                    break;                                      //--//
                }
                if (GameMode == TntWarsGameMode.TDM)
                {
                    if (i < 3)
                    {
                        SendAllPlayersScore(true, true);
                    }
                    if (i >= 3)
                    {
                        SendAllPlayersScore(true, true, true);
                        i = 0;
                    }
                    i++;
                }
                else if (GameMode == TntWarsGameMode.FFA)
                {
                    SendAllPlayersScore(false, true, true);
                }
            }
            END();
        }
示例#12
0
        public override void Use(Player p, string message)
        {
            try
            {
                if (message == "")
                {
                    Help(p); return;
                }
                bool stealth = false; bool totalBan = false;
                if (message[0] == '#')
                {
                    if (p == null)
                    {
                        message = message.Remove(0, 1).Trim();
                        stealth = true;
                        Server.s.Log("Stealth Ban Attempted by Console");
                    }
                    else
                    {
                        message = message.Remove(0, 1).Trim();
                        stealth = true;
                        Server.s.Log("Stealth Ban Attempted by " + p.name);
                    }
                }
                else if (message[0] == '@')
                {
                    if (p == null)
                    {
                        message = message.Remove(0, 1).Trim();
                        stealth = true;
                        Server.s.Log("Total Ban Attempted by Console");
                    }
                    else
                    {
                        totalBan = true;
                        message  = message.Remove(0, 1).Trim();
                        Server.s.Log("Total Ban Attempted by " + p.name);
                    }
                }
                string reason = "-";
                if (message.Split(' ').Length > 1)
                {
                    reason = message;
                    string newreason  = reason.Remove(0, reason.Split(' ')[0].Length + 1);
                    int    removetrim = newreason.Length + 1;
                    string newmessage = message.Remove(message.Length - removetrim, removetrim);
                    reason  = newreason;
                    message = newmessage;
                }
                if (reason == "-")
                {
                    reason = "&c-";
                }
                reason = reason.Replace(" ", "%20");
                Player who = Player.Find(message);

                if (who == null)
                {
                    if (!Player.ValidName(message))
                    {
                        Player.SendMessage(p, "Invalid name \"" + message + "\".");
                        return;
                    }
                    if (Server.devs.Contains(message.ToLower()))
                    {
                        Player.SendMessage(p, "You can't ban a MCForge Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban a MCForge Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban a MCForge Developer!");
                        }
                        return;
                    }
                    Group foundGroup = Group.findPlayerGroup(message);

                    if ((int)foundGroup.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "You can't ban a " + foundGroup.name + "!");
                        return;
                    }
                    if (foundGroup.Permission == LevelPermission.Banned)
                    {
                        Player.SendMessage(p, message + " is already banned.");
                        return;
                    }
                    if (p != null && foundGroup.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you.");
                        return;
                    }
                    string oldgroup = foundGroup.name.ToString();
                    foundGroup.playerList.Remove(message);
                    foundGroup.playerList.Save();
                    if (p != null)
                    {
                        Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + ".");
                    }
                    else
                    {
                        Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by console.");
                    }
                    Group.findPerm(LevelPermission.Banned).playerList.Add(message);
                    Ban.Banplayer(p, message, reason, stealth, oldgroup);
                }
                else
                {
                    if (!Player.ValidName(who.name))
                    {
                        Player.SendMessage(p, "Invalid name \"" + who.name + "\".");
                        return;
                    }
                    if (Server.devs.Contains(who.name.ToLower()))
                    {
                        Player.SendMessage(p, "You can't ban an MCForge Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban an MCForge Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban an MCForge Developer!");
                        }
                        return;
                    }
                    if ((int)who.group.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "You can't ban a " + who.group.name + "!");
                        return;
                    }
                    if (who.group.Permission == LevelPermission.Banned)
                    {
                        Player.SendMessage(p, message + " is already banned.");
                        return;
                    }
                    if (p != null && who.group.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you.");
                        return;
                    }
                    string oldgroup = who.group.name.ToString();
                    who.group.playerList.Remove(message);
                    who.group.playerList.Save();

                    if (p != null)
                    {
                        if (stealth)
                        {
                            Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " was STEALTH &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "!");
                        }
                        else
                        {
                            Player.GlobalMessage(who.color + who.name + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "!");
                        }
                    }
                    else
                    {
                        if (stealth)
                        {
                            Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " was STEALTH &8banned" + Server.DefaultColor + " by console.");
                        }
                        else
                        {
                            Player.GlobalMessage(who.color + who.name + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by console.");
                        }
                    }
                    who.group = Group.findPerm(LevelPermission.Banned);
                    who.color = who.group.color;
                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    Group.findPerm(LevelPermission.Banned).playerList.Add(who.name);
                    Ban.Banplayer(p, who.name, reason, stealth, oldgroup);
                }
                Group.findPerm(LevelPermission.Banned).playerList.Save();

                if (p != null)
                {
                    Server.IRC.Say(message + " was banned by " + p.name + ".");
                    Server.s.Log("BANNED: " + message.ToLower() + " by " + p.name);
                }
                else
                {
                    Server.IRC.Say(message + " was banned by console.");
                    Server.s.Log("BANNED: " + message.ToLower() + " by console.");
                }

                if (totalBan == true)
                {
                    Command.all.Find("undo").Use(p, message + " 0");
                    Command.all.Find("banip").Use(p, "@ " + message);
                }
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }
示例#13
0
        public override void Use(Player p, string message)
        {
            if (p != null && message == "")
            {
                message = "enter";
            }
            switch (message.ToLower())
            {
            case "enter":
                if (p == null)
                {
                    Player.SendMessage(p, "You can't execute this command as Console!");
                    return;
                }
                if (p.canusereview)
                {
                    Group           gre = Group.findPerm(Server.reviewenter);
                    LevelPermission lpe = gre.Permission;
                    if (p.group.Permission >= lpe)
                    {
                        foreach (string testwho in Server.reviewlist)
                        {
                            if (testwho == p.name)
                            {
                                Player.SendMessage(p, "You already entered the review queue!");
                                return;
                            }
                        }

                        bool isopson = false;
                        try
                        {
                            foreach (Player pl in Player.players)
                            {
                                if (pl.group.Permission >= Server.opchatperm && !pl.hidden)
                                {
                                    isopson = true;
                                    break;     // We're done, break out of this loop
                                }
                            }
                        }
                        catch    /* (Exception e)*/
                        {
                            isopson = true;
                        }
                        if (isopson == true)
                        {
                            Server.reviewlist.Add(p.name);
                            int reviewlistpos = Server.reviewlist.IndexOf(p.name);
                            if (reviewlistpos > 1)
                            {
                                Player.SendMessage(p, "You entered the &creview " + Server.DefaultColor + "queue. You have &c" + reviewlistpos.ToString() + Server.DefaultColor + " people in front of you in the queue");
                            }
                            if (reviewlistpos == 1)
                            {
                                Player.SendMessage(p, "You entered the &creview " + Server.DefaultColor + "queue. There is &c1 " + Server.DefaultColor + "person in front of you in the queue");
                            }
                            if ((reviewlistpos + 1) == 1)
                            {
                                Player.SendMessage(p, "You entered the &creview " + Server.DefaultColor + "queue. You are &cfirst " + Server.DefaultColor + "in line!");
                            }
                            Player.SendMessage(p, "The Online Operators have been notified. Someone should be with you shortly.");
                            Player.GlobalMessageOps(p.color + " - " + p.name + " - " + Server.DefaultColor + "entered the review queue");
                            if ((reviewlistpos + 1) > 1)
                            {
                                Player.GlobalMessageOps("There are now &c" + (reviewlistpos + 1) + Server.DefaultColor + " people waiting for &creview!");
                            }
                            else
                            {
                                Player.GlobalMessageOps("There is now &c1 " + Server.DefaultColor + "person waiting for &creview!");
                            }
                            p.ReviewTimer();
                        }
                        else
                        {
                            Player.SendMessage(p, "&cThere are no operators on to review your build. Please wait for one to come on and try again.");
                        }
                    }
                }
                else
                {
                    Player.SendMessage(p, "You have to wait " + Server.reviewcooldown + " seconds everytime you use this command");
                }
                break;

            case "list":
            case "view":
                if (p == null)
                {
                    if (Server.reviewlist.Count != 0)
                    {
                        Player.SendMessage(p, "Players in the review queue:");
                        int viewnumb = 1;
                        foreach (string golist in Server.reviewlist)
                        {
                            string FoundRank = Group.findPlayer(golist.ToLower());
                            Player.SendMessage(p, viewnumb.ToString() + ". " + golist + " - Current Rank: " + FoundRank);
                            viewnumb++;
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, "There are no players in the review queue!");
                    }
                    return;
                }
                Group           grv = Group.findPerm(Server.reviewview);
                LevelPermission lpv = grv.Permission;
                if (p.group.Permission >= lpv && p != null)
                {
                    if (Server.reviewlist.Count != 0)
                    {
                        Player.SendMessage(p, "&9Players in the review queue:");
                        int viewnumb = 1;
                        foreach (string golist in Server.reviewlist)
                        {
                            string FoundRank = Group.findPlayer(golist.ToLower());
                            Player.SendMessage(p, "&a" + viewnumb.ToString() + ". &f" + golist + "&a - Current Rank: " + Group.Find(FoundRank).color + FoundRank);
                            viewnumb++;
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, "There are no players in the review queue!");
                    }
                }
                break;

            case "leave":
                if (p == null)
                {
                    Player.SendMessage(p, "You can't execute this command as Console!");
                    return;
                }
                Group           grl = Group.findPerm(Server.reviewleave);
                LevelPermission lpl = grl.Permission;
                if (p.group.Permission >= lpl)
                {
                    bool leavetest = false;
                    foreach (string testwho2 in Server.reviewlist)
                    {
                        if (testwho2 == p.name)
                        {
                            leavetest = true;
                        }
                    }
                    if (!leavetest)
                    {
                        Player.SendMessage(p, "You aren't in the review queue so you can't leave it!");
                        return;
                    }
                    Server.reviewlist.Remove(p.name);
                    int toallplayerscount = 1;
                    foreach (string toallplayers in Server.reviewlist)
                    {
                        Player tosend = Player.Find(toallplayers);
                        Player.SendMessage(tosend, "The review queue has changed. Your now on spot " + toallplayerscount.ToString() + ".");
                        toallplayerscount++;
                    }
                    Player.SendMessage(p, "You have left the review queue!");
                    return;
                }
                break;

            case "next":
                if (p == null)
                {
                    Player.SendMessage(p, "You can't execute this command as Console!");
                    return;
                }
                Group           grn = Group.findPerm(Server.reviewnext);
                LevelPermission lpn = grn.Permission;
                if (p.group.Permission >= lpn)
                {
                    if (Server.reviewlist.Count == 0)
                    {
                        Player.SendMessage(p, "There are no players in the review queue!");
                        return;
                    }
                    string[] user = Server.reviewlist.ToArray();
                    Player   who  = Player.Find(user[0]);
                    if (who == null)
                    {
                        Player.SendMessage(p, "Player " + user[0] + " doesn't exist or is offline. " + user[0] + " has been removed from the review queue");
                        Server.reviewlist.Remove(user[0]);
                        return;
                    }
                    if (who == p)
                    {
                        Player.SendMessage(p, "You can't teleport to yourself! You have been removed from the review queue.");
                        Server.reviewlist.Remove(user[0]);
                        return;
                    }
                    Server.reviewlist.Remove(user[0]);
                    Command.all.Find("tp").Use(p, who.name);
                    Player.SendMessage(p, "You have been teleported to " + user[0]);
                    Player.SendMessage(who, "Your request has been answered by " + p.name + ".");
                    int toallplayerscount = 0;
                    foreach (string toallplayers in Server.reviewlist)
                    {
                        Player who2 = Player.Find(toallplayers);
                        Player.SendMessage(who2, "The review queue has been rotated. you now have " + toallplayerscount.ToString() + " players waiting in front of you");
                        toallplayerscount++;
                    }
                }
                else
                {
                    Player.SendMessage(p, "&cYou have no permission to use the review queue!");
                }
                break;

            case "clear":
                if (p == null)
                {
                    Server.reviewlist.Clear();
                    Player.SendMessage(p, "The review queue has been cleared");
                    return;
                }
                Group           grc = Group.findPerm(Server.reviewclear);
                LevelPermission lpc = grc.Permission;
                if (p.group.Permission >= lpc)
                {
                    Server.reviewlist.Clear();
                    Player.SendMessage(p, "The review queue has been cleared");
                    return;
                }
                else
                {
                    Player.SendMessage(p, "&cYou have no permission to clear the Review Queue!");
                }
                break;

            default: Help(p); return;
            }
        }
示例#14
0
        // This is where the magic happens, naturally.
        // p is the player object for the player executing the command.  message is everything after the command invocation itself.
        public override void Use(Player p, string message)
        {
            if (!Directory.Exists("text/lockdown"))
            {
                Player.SendMessage(p, "Could not locate the folder creating one now.");
                Directory.CreateDirectory("text/lockdown");
                Directory.CreateDirectory("text/lockdown/map");
                Player.SendMessage(p, "Added the settings for the command");
            }

            string[] param = message.Split(' ');


            if (param.Length == 2 && (param[0] == "map" || param[0] == "player"))
            {
                if (param[0] == "map")
                {
                    if (!Directory.Exists("text/lockdown/map"))
                    {
                        p.SendMessage("Could not locate the map folder, creating one now.");
                        Directory.CreateDirectory("text/lockdown/map");
                        p.SendMessage("Added the map settings Directory within 'text/lockdown'!");
                    }

                    string filepath        = "text/lockdown/map/" + param[1] + "";
                    bool   mapIsLockedDown = File.Exists(filepath);

                    if (!mapIsLockedDown)
                    {
                        File.Create(filepath);
                        Player.GlobalMessage("The map " + param[1] + " has been locked");
                        Player.GlobalMessageOps("Locked by: " + ((p == null) ? "Console" : p.name));
                    }
                    else
                    {
                        File.Delete(filepath);
                        Player.GlobalMessage("The map " + param[1] + " has been unlocked");
                        Player.GlobalMessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name));
                    }
                }

                if (param[0] == "player")
                {
                    Player who = Player.Find(param[1]);

                    if (Server.devs.Contains(who.name))
                    {
                        Player.SendMessage(p, "You can't lockdown a dev!");
                        return;
                    }

                    if (who == null)
                    {
                        Player.SendMessage(p, "There is no player with such name online");
                        return;
                    }


                    if (!who.jailed)
                    {
                        if (p != null)
                        {
                            if (who.group.Permission >= p.group.Permission)
                            {
                                Player.SendMessage(p, "Cannot lock down someone of equal or greater rank.");
                                return;
                            }
                        }
                        if (p != null && who.level != p.level)
                        {
                            Player.SendMessage(p, "Moving player to your map...");
                            Command.all.Find("goto").Use(who, p.level.name);
                            int waits = 0;
                            while (who.Loading)
                            {
                                Thread.Sleep(500);
                                // If they don't load in 10 seconds, eff it.
                                if (waits++ == 20)
                                {
                                    break;
                                }
                            }
                        }
                        Player.GlobalDie(who, false);
                        who.jailed = true;
                        Player.GlobalChat(p, who.color + who.name + Server.DefaultColor + " has been locked down!", true);
                        Player.GlobalMessageOps("Locked by: " + ((p == null) ? "Console" : p.name));
                        return;
                    }
                    else
                    {
                        who.jailed = false;
                        Player.GlobalChat(p, who.color + who.name + Server.DefaultColor + " has been unlocked.", true);
                        Player.GlobalMessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name));
                        return;
                    }
                }
            }
            else
            {
                Help(p);
                return;
            }
        }
示例#15
0
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                Player.SendMessage(p, "This command can only be used in-game!"); return;
            }
            if (message == "check")
            {
                if (p.hidden)
                {
                    Player.SendMessage(p, "You are currently hidden!");
                    return;
                }
                else
                {
                    Player.SendMessage(p, "You are not currently hidden!");
                    return;
                }
            }
            else
            if (message != "")
            {
                if (p.possess != "")
                {
                    Player.SendMessage(p, "Stop your current possession first.");
                    return;
                }
            }
            Command opchat    = Command.all.Find("opchat");
            Command adminchat = Command.all.Find("adminchat");

            p.hidden = !p.hidden;
            if (p.hidden)
            {
                Player.GlobalDie(p, true);
                Player.GlobalMessageOps("To Ops -" + p.color + p.name + "-" + Server.DefaultColor + " is now &finvisible" + Server.DefaultColor + ".");
                Player.GlobalChat(p, "&c- " + p.color + p.prefix + p.name + Server.DefaultColor + " " + (File.Exists("text/logout/" + p.name + ".txt") ? File.ReadAllText("text/logout/" + p.name + ".txt") : "Disconnected."), false);
                Server.IRC.Say(p.name + " left the game (Disconnected.)");
                if (!p.opchat)
                {
                    opchat.Use(p, message);
                }
                //Player.SendMessage(p, "You're now &finvisible&e.");
            }
            else
            {
                Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                Player.GlobalMessageOps("To Ops -" + p.color + p.name + "-" + Server.DefaultColor + " is now &8visible" + Server.DefaultColor + ".");
                Player.GlobalChat(p, "&a+ " + p.color + p.prefix + p.name + Server.DefaultColor + " " + (File.Exists("text/login/" + p.name + ".txt") ? File.ReadAllText("text/login/" + p.name + ".txt") : "joined the game."), false);
                Server.IRC.Say(p.name + " joined the game");
                if (p.opchat)
                {
                    opchat.Use(p, message);
                }
                if (p.adminchat)
                {
                    adminchat.Use(p, message);
                }
                //Player.SendMessage(p, "You're now &8visible&e.");
            }
        }
示例#16
0
        public override void Use(Player p, string message)
        {
            try
            {
                if (message == "")
                {
                    Help(p); return;
                }

                bool stealth = false; bool totalBan = false;
                if (message[0] == '#')
                {
                    message = message.Remove(0, 1).Trim();
                    stealth = true;
                    Server.s.Log("Stealth Ban Attempted");
                }
                else if (message[0] == '@')
                {
                    totalBan = true;
                    message  = message.Remove(0, 1).Trim();
                }

                Player who = Player.Find(message);

                if (who == null)
                {
                    if (!Player.ValidName(message))
                    {
                        Player.SendMessage(p, "Invalid name \"" + message + "\".");
                        return;
                    }
                    if (Server.devs.Contains(message.ToLower()))
                    {
                        Player.SendMessage(p, "You can't ban a MCForge Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban a MCForge Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban a MCForge Developer!");
                        }
                        return;
                    }
                    Group foundGroup = Group.findPlayerGroup(message);

                    if (foundGroup.Permission >= LevelPermission.Operator)
                    {
                        Player.SendMessage(p, "You can't ban a " + foundGroup.name + "!");
                        return;
                    }
                    if (foundGroup.Permission == LevelPermission.Banned)
                    {
                        Player.SendMessage(p, message + " is already banned.");
                        return;
                    }

                    foundGroup.playerList.Remove(message);
                    foundGroup.playerList.Save();

                    Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + "!");
                    Group.findPerm(LevelPermission.Banned).playerList.Add(message);
                }
                else
                {
                    if (!Player.ValidName(who.name))
                    {
                        Player.SendMessage(p, "Invalid name \"" + who.name + "\".");
                        return;
                    }
                    if (Server.devs.Contains(who.name.ToLower()))
                    {
                        Player.SendMessage(p, "You can't ban a MCForge Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban a MCForge Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban a MCForge Developer!");
                        }
                        return;
                    }
                    if (who.group.Permission >= LevelPermission.Operator)
                    {
                        Player.SendMessage(p, "You can't ban a " + who.group.name + "!");
                        return;
                    }
                    if (who.group.Permission == LevelPermission.Banned)
                    {
                        Player.SendMessage(p, message + " is already banned.");
                        return;
                    }

                    who.group.playerList.Remove(message);
                    who.group.playerList.Save();

                    if (stealth)
                    {
                        Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " is now STEALTH &8banned" + Server.DefaultColor + "!");
                    }
                    else
                    {
                        Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + "!", false);
                    }

                    who.group = Group.findPerm(LevelPermission.Banned);
                    who.color = who.group.color;
                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    Group.findPerm(LevelPermission.Banned).playerList.Add(who.name);
                }
                Group.findPerm(LevelPermission.Banned).playerList.Save();

                IRCBot.Say(message + " was banned.");
                Server.s.Log("BANNED: " + message.ToLower());

                if (totalBan == true)
                {
                    Command.all.Find("undo").Use(p, message + " 0");
                    Command.all.Find("banip").Use(p, "@ " + message);
                }
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }