Ejemplo n.º 1
0
        public void Say(string message, Player p = null)
        {
            if (p != null && p.muted)
            {
                Player.SendMessage(p, "*Tears* You aren't allowed to talk to the nice people of global chat");
            }
            if ((p == null && !Server.canusegc) || (p != null && !p.canusegc))
            {
                Player.SendMessage(p, "You can no longer use the GC!");
                return;
            }
            #region General rules
            if (message.Contains("minecraft.net/classic/play/"))
            {
                Player.SendMessage(p, "No server links Mr whale!");
                if (p == null)
                {
                    Server.gcmultiwarns++;
                }
                else
                {
                    p.multi++;
                    Command.all.Find("gcrules").Use(p, "");
                }
                return;
            }
            if (message.Contains("http://") || message.Contains("https://") || message.Contains("www."))
            {
                Player.SendMessage(p, "No links!");
                if (p == null)
                {
                    Server.gcmultiwarns++;
                }
                else
                {
                    p.multi++;
                    Command.all.Find("gcrules").Use(p, "");
                }
                return;
            }
            if (Player.HasBadColorCodes(message))
            {
                Player.SendMessage(p, "Can't let you do that Mr whale!");
                if (p != null)
                {
                    p.Kick("Kicked for trying to crash all players!");
                }
                return;
            }
            if (message.ToLower().Contains(Server.name.ToLower()))
            {
                Player.SendMessage(p, "Let's not advertise Mr whale!");
                if (p != null)
                {
                    p.multi++;
                }
                else
                {
                    Server.gcmultiwarns++;
                }
                return;
            }
            #endregion
            #region Repeating message spam
            if ((p == null ? Server.gclastmsg : p.lastmsg) == message.ToLower())
            {
                if (p == null)
                {
                    Server.gcspamcount++; Server.gcmultiwarns++;
                }
                else
                {
                    p.spamcount++; p.multi++;
                }
                Player.SendMessage(p, "Don't send repetitive messages!");
                if ((p == null ? Server.gcspamcount : p.spamcount) >= 4)
                {
                    if (p == null)
                    {
                        Server.canusegc = false;
                    }
                    else
                    {
                        p.canusegc = false;
                    }
                    Player.SendMessage(p, "You can no longer use the gc! Reason: repetitive message spam");
                    return;
                }
                if ((p == null ? Server.gcspamcount : p.spamcount) >= 2)
                {
                    return;
                }
                return;
            }
            else
            {
                if (p != null)
                {
                    p.lastmsg = message.ToLower(); p.spamcount = 0;
                }
                else
                {
                    Server.gclastmsg = message.ToLower(); Server.gcspamcount = 0;
                }
            }
            #endregion

            /*
             #region Caps spam
             * int rage = 0;
             * for (int i = 0; i < message.Length; i++) { if (caps.IndexOf(message[i]) != -1) { rage++; } }
             * if (rage >= 7 && !(message.Length <= 7)) { //maybe more if there are still people who use proper capitalization?
             *  Player.SendMessage(p, "Woah there Mr whale, lay of the caps!");
             *  message = message.ToLower();
             *  if (p == null) { Server.gccapscount++; Server.gcmultiwarns++; }
             *  else { p.capscount++; p.multi++; }
             *  if ((p == null ? Server.gccapscount : p.capscount) >= 5) {
             *      if (p == null) { Server.canusegc = false; }
             *      else { Server.canusegc = false; }
             *      Player.SendMessage(p, "You can no longer use the gc! Reason: caps spam");
             *      return;
             *  }
             *  if (rage >= 10) { return; }
             * }
             #endregion*/
            #region Flooding
            TimeSpan t = DateTime.Now - (p == null ? Server.gclastmsgtime : p.lastmsgtime);
            if (t < new TimeSpan(0, 0, 1))
            {
                Player.SendMessage(p, "Stop the flooding buddy!");
                if (p == null)
                {
                    Server.gcfloodcount++; Server.gcmultiwarns++;
                }
                else
                {
                    p.floodcount++; p.multi++;
                }
                if ((p == null ? Server.gcfloodcount : p.floodcount) >= 5)
                {
                    if (p == null)
                    {
                        Server.canusegc = false;
                    }
                    else
                    {
                        p.canusegc = false;
                    }
                    Player.SendMessage(p, "You can no longer use the gc! Reason: flooding");
                }
                if ((p == null ? Server.gcfloodcount : p.floodcount) >= 3)
                {
                    return;
                }
            }
            if (p != null)
            {
                p.lastmsgtime = DateTime.Now;
            }
            else
            {
                Server.gclastmsgtime = DateTime.Now;
            }
            #endregion

            if ((p == null ? Server.gcmultiwarns : p.multi) >= 10)
            {
                if (p == null)
                {
                    Server.canusegc = false;
                }
                else
                {
                    p.canusegc = false;
                }
                Player.SendMessage(p, "You can no longer use the gc! Reason: multiple offenses!");
                return;
            }
            if (OnNewSayGlobalMessage != null)
            {
                OnNewSayGlobalMessage(p == null ? "Console" : p.name, message);
            }
            if (Server.UseGlobalChat && IsConnected())
            {
                connection.Sender.PublicMessage(channel, message);
            }
        }
Ejemplo n.º 2
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)
 {
     p.Kick("RAGEQUIT!!");
 }
Ejemplo n.º 3
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)
 {
     p.Kick("RAGEQUIT!!");
 }
Ejemplo n.º 4
0
        public void Say(string message, Player p = null)
        {
            message = RemoveWhitespace(message);
            if (p != null && p.muted)
            {
                Player.SendMessage(p, "*Tears* You aren't allowed to talk to the nice people of global chat");
            }
            if ((p == null && !Server.canusegc) || (p != null && !p.canusegc))
            {
                Player.SendMessage(p, "You can no longer use the GC!");
                return;
            }
            #region General rules
            if (message.Contains("minecraft.net/classic/play/"))
            {
                Player.SendMessage(p, "No server links Mr whale!");
                if (p == null)
                {
                    Server.gcmultiwarns++;
                }
                else
                {
                    p.multi++;
                    Command.all.Find("gcrules").Use(p, "");
                }
                return;
            }
            if (message.Contains("http://") || message.Contains("https://") || message.Contains("www."))
            {
                Player.SendMessage(p, "No links!");
                if (p == null)
                {
                    Server.gcmultiwarns++;
                }
                else
                {
                    p.multi++;
                    Command.all.Find("gcrules").Use(p, "");
                }
                return;
            }
            if (Player.HasBadColorCodes(message))
            {
                Player.SendMessage(p, "Can't let you do that Mr whale!");
                if (p != null) { p.Kick("Kicked for trying to crash all players!"); }
                return;
            }
            if (message.ToLower().Contains(Server.name.ToLower()))
            {
                Player.SendMessage(p, "Let's not advertise Mr whale!");
                if (p != null) { p.multi++; }
                else { Server.gcmultiwarns++; }
                return;
            }
            #endregion
            #region Repeating message spam
            if ((p == null ? Server.gclastmsg : p.lastmsg) == message.ToLower())
            {
                if (p == null) { Server.gcspamcount++; Server.gcmultiwarns++; }
                else { p.spamcount++; p.multi++; }
                Player.SendMessage(p, "Don't send repetitive messages!");
                if ((p == null ? Server.gcspamcount : p.spamcount) >= 4)
                {
                    if (p == null) { Server.canusegc = false; }
                    else { p.canusegc = false; }
                    Player.SendMessage(p, "You can no longer use the gc! Reason: repetitive message spam");
                    return;
                }
                if ((p == null ? Server.gcspamcount : p.spamcount) >= 2) { return; }
                return;
            }
            else
            {
                if (p != null) { p.lastmsg = message.ToLower(); p.spamcount = 0; }
                else { Server.gclastmsg = message.ToLower(); Server.gcspamcount = 0; }
            }
            #endregion
            #region Flooding

            TimeSpan t = DateTime.Now - (p == null ? Server.gclastmsgtime : p.lastmsgtime);

            if (t < new TimeSpan(0, 0, 1))
            {
                Player.SendMessage(p, "Stop the flooding buddy!");

                if (p == null)
                {
                    Server.gcfloodcount++;
                    Server.gcmultiwarns++;
                }
                else
                {
                    p.floodcount++;
                    p.multi++;
                }

                if ((p == null ? Server.gcfloodcount : p.floodcount) >= 5)
                {
                    if (p == null)
                        Server.canusegc = false;
                    else
                        p.canusegc = false;

                    Player.SendMessage(p, "You can no longer use the gc! Reason: flooding");
                }
                if ((p == null ? Server.gcfloodcount : p.floodcount) >= 3) { return; }
            }
            if (p != null)
            {
                p.lastmsgtime = DateTime.Now;
            }
            else
            {
                Server.gclastmsgtime = DateTime.Now;
            }

            #endregion

            if ((p == null ? Server.gcmultiwarns : p.multi) >= 10)
            {
                if (p == null)
                    Server.canusegc = false;
                else
                    p.canusegc = false;
                Player.SendMessage(p, "You can no longer use the gc! Reason: multiple offenses!");

                return;
            }

            if (String.IsNullOrEmpty(message.Replace("Console:", "").Trim()))
            {
                Player.SendMessage(p, "You should send some text!");
                return;
            }

            if (OnNewSayGlobalMessage != null)
                OnNewSayGlobalMessage(p == null ? "Console" : p.name, message);

            if (Server.UseGlobalChat && IsConnected())
                connection.Sender.PublicMessage(channel, message);
        }
        public void Say(string message, Player p = null)
        {
            RemoveVariables(ref message);
            RemoveWhitespace(ref message);

            if (p != null && p.muted)
            {
                Player.SendMessage(p, "*Tears* You aren't allowed to talk to the nice people of global chat");
            }
            if ((p == null && !Server.canusegc) || (p != null && !p.canusegc))
            {
                Player.SendMessage(p, "You can no longer use the GC!");
                return;
            }
            #region General rules
            if (message.Contains("minecraft.net/classic/play/"))
            {
                Player.SendMessage(p, "No server links Mr whale!");
                if (p == null)
                {
                    Server.gcmultiwarns++;
                }
                else
                {
                    p.multi++;
                    Command.all.Find("gcrules").Use(p, "");
                }
                return;
            }
            if (message.Contains("http://") || message.Contains("https://") || message.Contains("www."))
            {
                Player.SendMessage(p, "No links!");
                if (p == null)
                {
                    Server.gcmultiwarns++;
                }
                else
                {
                    p.multi++;
                    Command.all.Find("gcrules").Use(p, "");
                }
                return;
            }
            if (Player.HasBadColorCodes(message))
            {
                Player.SendMessage(p, "Can't let you do that Mr whale!");
                if (p != null)
                {
                    p.Kick("Kicked for trying to crash all players!");
                }
                return;
            }
            if (message.ToLower().Contains(Server.name.ToLower()))
            {
                Player.SendMessage(p, "Let's not advertise Mr whale!");
                if (p != null)
                {
                    p.multi++;
                }
                else
                {
                    Server.gcmultiwarns++;
                }
                return;
            }
            #endregion
            #region Repeating message spam
            if ((p == null ? Server.gclastmsg : p.lastmsg) == message.ToLower())
            {
                if (p == null)
                {
                    Server.gcspamcount++; Server.gcmultiwarns++;
                }
                else
                {
                    p.spamcount++; p.multi++;
                }
                Player.SendMessage(p, "Don't send repetitive messages!");
                if ((p == null ? Server.gcspamcount : p.spamcount) >= 4)
                {
                    if (p == null)
                    {
                        Server.canusegc = false;
                    }
                    else
                    {
                        p.canusegc = false;
                    }
                    Player.SendMessage(p, "You can no longer use the gc! Reason: repetitive message spam");
                    return;
                }
                if ((p == null ? Server.gcspamcount : p.spamcount) >= 2)
                {
                    return;
                }
                return;
            }
            else
            {
                if (p != null)
                {
                    p.lastmsg = message.ToLower(); p.spamcount = 0;
                }
                else
                {
                    Server.gclastmsg = message.ToLower(); Server.gcspamcount = 0;
                }
            }
            #endregion
            #region Flooding

            TimeSpan t = DateTime.Now - (p == null ? Server.gclastmsgtime : p.lastmsgtime);

            if (t < new TimeSpan(0, 0, 1))
            {
                Player.SendMessage(p, "Stop the flooding buddy!");

                if (p == null)
                {
                    Server.gcfloodcount++;
                    Server.gcmultiwarns++;
                }
                else
                {
                    p.floodcount++;
                    p.multi++;
                }

                if ((p == null ? Server.gcfloodcount : p.floodcount) >= 5)
                {
                    if (p == null)
                    {
                        Server.canusegc = false;
                    }
                    else
                    {
                        p.canusegc = false;
                    }

                    Player.SendMessage(p, "You can no longer use the gc! Reason: flooding");
                }
                if ((p == null ? Server.gcfloodcount : p.floodcount) >= 3)
                {
                    return;
                }
            }
            if (p != null)
            {
                p.lastmsgtime = DateTime.Now;
            }
            else
            {
                Server.gclastmsgtime = DateTime.Now;
            }

            #endregion

            if ((p == null ? Server.gcmultiwarns : p.multi) >= 10)
            {
                if (p == null)
                {
                    Server.canusegc = false;
                }
                else
                {
                    p.canusegc = false;
                }
                Player.SendMessage(p, "You can no longer use the gc! Reason: multiple offenses!");

                return;
            }

            if (String.IsNullOrEmpty(message.Replace("Console:", "").Trim()))
            {
                Player.SendMessage(p, "You should send some text!");
                return;
            }

            if (OnNewSayGlobalMessage != null)
            {
                OnNewSayGlobalMessage(p == null ? "Console" : p.name, message);
            }

            if (Server.UseGlobalChat && IsConnected())
            {
                connection.Sender.PublicMessage(channel, message);
            }
        }
Ejemplo n.º 6
0
        public override void Use(Player p, string message)
        {
            string warnedby;

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

            Player who = Player.Find(message.Split(' ')[0]);

            // Make sure we have a valid player
            if (who == null)
            {
                Player.SendMessage(p, "Player not found!");
                return;
            }

            // Don't warn a dev
            if (Server.devs.Contains(who.name))
            {
                Player.SendMessage(p, "Why are you warning a dev??");
                return;
            }

            // Don't warn yourself... derp
            if (who == p)
            {
                Player.SendMessage(p, "you can't warn yourself");
                return;
            }

            // Check the caller's rank
            if (p != null && p.group.Permission <= who.group.Permission)
            {
                Player.SendMessage(p, "you can't warn a player equal or higher rank.");
                return;
            }

            // We need a reason
            if (message.Split(' ').Length == 1)
            {
                // No reason was given
                reason = "you know why.";
            }
            else
            {
                reason = message.Substring(message.IndexOf(' ') + 1).Trim();
            }

            warnedby = (p == null) ? "console" : p.color + p.name;
            Player.GlobalMessage(warnedby + " %ewarned " + who.color + who.name + " %ebecause:");
            Player.GlobalMessage("&c" + reason);

            //Player.SendMessage(who, "Do it again ");
            if (who.warn == 0)
            {
                Player.SendMessage(who, "Do it again twice and you will get kicked!");
                who.warn = 1;
                return;
            }
            if (who.warn == 1)
            {
                Player.SendMessage(who, "Do it one more time and you will get kicked!");
                who.warn = 2;
                return;
            }
            if (who.warn == 2)
            {
                Player.GlobalMessage(who.color + who.name + " " + Server.DefaultColor + "was warn-kicked by " + warnedby);
                who.warn = 0;
                who.Kick("KICKED BECAUSE " + reason + "");
                return;
            }
        }
Ejemplo n.º 7
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");
 }
Ejemplo n.º 8
0
 public override void Use(Player p, string message)
 {
     p.Kick("Kicked for trying to kick all players from the server!");
 }
Ejemplo n.º 9
0
        public override void Use(Player p, string message)
        {
            string Owner = Server.server_owner;
            if (Server.server_owner == "Notch")
            {
                Owner = "the owner";
            }
            if (p.group.Permission < Server.verifyadminsrank)
            {
                Player.SendMessage(p, "You do not have the &crequired rank to use this command!");
                return;
            }
            if (Server.verifyadmins == false)
            {
                Player.SendMessage(p, "Verification of admins is &cdisabled!");
                return;
            }
            if (p.adminpen == false)
            {
                {
                    Player.SendMessage(p, "You have &calready verified" + Server.DefaultColor + ", why are you using this?");
                    Player.SendMessage(p, "To set a new password use &a/setpass [Pass]!");
                    return;
                }
            }
            if (p.passtries == 3)
            {
                p.Kick("Did you really think you could keep on guessing?");
                return;
            }
            int foundone = 0;
            if (message == "")
            {
                Help(p);
                return;

            }
            int number = message.Split(' ').Length;
            if (number > 1)
            {
                Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!");
                return;
            }
            if (!Directory.Exists("extra/passwords"))
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            DirectoryInfo di = new DirectoryInfo("extra/passwords/");
            FileInfo[] fi = di.GetFiles("*.xml");
            Thread.Sleep(10);
            try
            {
                foreach (FileInfo file in fi)
                {
                    if (file.Name.Replace(".xml", "").ToLower() == p.name.ToLower())
                    {
                        foundone++;
                    }
                }
            }
            catch
            {
                Player.SendMessage(p, "An Error Occurred! Try again soon!");
                return;
            }
            if (foundone < 0)
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            if (foundone > 1)
            {
                Player.SendMessage(p, "&cAn error has occurred!");
                return;
            }
            if (!File.Exists("extra/passwords/" + p.name.ToLower() + ".xml"))
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.name.ToLower() + ".xml"), "MCForgeEncryption", p, message);
            if (message == password)
            {
                Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
                if (p.adminpen == true)
                {
                    p.adminpen = false;
                }
                password = "";
                p.passtries = 0;
                return;
            }
            p.passtries++;
            Player.SendMessage(p, "&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
            Player.SendMessage(p, "If you have &cforgotten your password, " + Server.DefaultColor + "contact " + Owner + " and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.passtries);
            return;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// kicker
        /// </summary>
        /// <param name="p">Player</param>
        /// <param name="newRank">Group</param>
        private void kick(Player p, Group newRank)
        {
            try
            {

                if (Server.hackrank_kick == true)
                {
                    int kicktime = (Server.hackrank_kick_time * 1000);

                    m_old_color = p.color;

                    //make the timer for the kick
                    System.Timers.Timer messageTimer = new System.Timers.Timer(kicktime);

                    //start the timer
                    messageTimer.Start();

                    //delegate the timer
                    messageTimer.Elapsed += delegate
                    {
                        //kick him!
                        p.Kick("You have been kicked for hacking the rank " + newRank.color + newRank.name);
                        p.color = m_old_color;
                        killTimer(messageTimer);
                    };
                }
            }
            catch
            {
                Player.SendMessage(p, "An error has happend! It wont kick you now! :|");
            }
        }
Ejemplo n.º 11
0
        public void Say(string message, Player p = null)
        {
            if (p != null && p.muted) {
                Player.SendMessage(p, "*Tears* You aren't allowed to talk to the nice people of global chat");
            }
            if ((p == null && !Server.canusegc) || (p != null && !p.canusegc)) {
                Player.SendMessage(p, "You can no longer use the GC!");
                return;
            }
            #region General rules
            if (message.Contains("minecraft.net/classic/play/")) {
                Player.SendMessage(p, "No server links Mr whale!");
                if (p == null) {
                    Server.gcmultiwarns++;
                }
                else {
                    p.multi++;
                    Command.all.Find("gcrules").Use(p, "");
                }
                return;
            }
            if (message.Contains("http://") || message.Contains("https://") || message.Contains("www.")) {
                Player.SendMessage(p, "No links!");
                if (p == null) {
                    Server.gcmultiwarns++;
                }
                else {
                    p.multi++;
                    Command.all.Find("gcrules").Use(p, "");
                }
                return;
            }
            if (Player.HasBadColorCodes(message)) {
                Player.SendMessage(p, "Can't let you do that Mr whale!");
                if (p != null) { p.Kick("Kicked for trying to crash all players!"); }
                return;
            }
            if (message.ToLower().Contains(Server.name.ToLower())) {
                Player.SendMessage(p, "Let's not advertise Mr whale!");
                if (p != null) { p.multi++; }
                else { Server.gcmultiwarns++; }
                return;
            }
            #endregion
            #region Repeating message spam
            if ((p == null ? Server.gclastmsg : p.lastmsg) == message.ToLower()) {
                if (p == null) { Server.gcspamcount++; Server.gcmultiwarns++; }
                else { p.spamcount++; p.multi++; }
                Player.SendMessage(p, "Don't send repetitive messages!");
                if ((p == null ? Server.gcspamcount : p.spamcount) >= 4) {
                    if (p == null) { Server.canusegc = false; }
                    else { p.canusegc = false; }
                    Player.SendMessage(p, "You can no longer use the gc! Reason: repetitive message spam");
                    return;
                }
                if ((p == null ? Server.gcspamcount : p.spamcount) >= 2) { return; }
                return;
            }
            else {
                if (p != null) { p.lastmsg = message.ToLower(); p.spamcount = 0; }
                else { Server.gclastmsg = message.ToLower(); Server.gcspamcount = 0; }
            }
            #endregion
            /*
            #region Caps spam
            int rage = 0;
            for (int i = 0; i < message.Length; i++) { if (caps.IndexOf(message[i]) != -1) { rage++; } }
            if (rage >= 7 && !(message.Length <= 7)) { //maybe more if there are still people who use proper capitalization?
                Player.SendMessage(p, "Woah there Mr whale, lay of the caps!");
                message = message.ToLower();
                if (p == null) { Server.gccapscount++; Server.gcmultiwarns++; }
                else { p.capscount++; p.multi++; }
                if ((p == null ? Server.gccapscount : p.capscount) >= 5) {
                    if (p == null) { Server.canusegc = false; }
                    else { Server.canusegc = false; }
                    Player.SendMessage(p, "You can no longer use the gc! Reason: caps spam");
                    return;
                }
                if (rage >= 10) { return; }
            }
            #endregion*/
            #region Flooding
            TimeSpan t = DateTime.Now - (p == null ? Server.gclastmsgtime : p.lastmsgtime);
            if (t < new TimeSpan(0, 0, 1)) {
                Player.SendMessage(p, "Stop the flooding buddy!");
                if (p == null) { Server.gcfloodcount++; Server.gcmultiwarns++; }
                else { p.floodcount++; p.multi++; }
                if ((p == null ? Server.gcfloodcount : p.floodcount) >= 5) {
                    if (p == null) { Server.canusegc = false; }
                    else { p.canusegc = false; }
                    Player.SendMessage(p, "You can no longer use the gc! Reason: flooding");
                }
                if ((p == null ? Server.gcfloodcount : p.floodcount) >= 3) { return; }
            }
            if (p != null) { p.lastmsgtime = DateTime.Now; }
            else { Server.gclastmsgtime = DateTime.Now; }
            #endregion

            if ((p == null ? Server.gcmultiwarns : p.multi) >= 10) {
                if (p == null) { Server.canusegc = false; }
                else { p.canusegc = false; }
                Player.SendMessage(p, "You can no longer use the gc! Reason: multiple offenses!");
                return;
            }
            if (OnNewSayGlobalMessage != null)
                OnNewSayGlobalMessage(p == null ? "Console" : p.name, message);
            if (Server.UseGlobalChat && IsConnected())
                connection.Sender.PublicMessage(channel, message);
        }
Ejemplo n.º 12
0
 public override void Use(Player p, string message)
 {
     if (message != "") { Help(p); return; }
     p.Kick("Your IP has been backtraced + reported to FBI Cyber Crimes Unit.");
 }
Ejemplo n.º 13
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 0x" + Convert.ToString(p.random.Next(int.MinValue, int.MaxValue), 16).ToUpper());
 }
Ejemplo n.º 14
0
        /// <summary>
        /// with Ban you can check the info about someone's ban, find out if there's info about someone, and add / remove someone to the baninfo (NOT THE BANNED.TXT !)
        /// </summary>
        /// <param name="p">The player who executed the command</param>
        /// <param name="who">The player that's banned</param>
        /// <param name="reason">The reason for the ban</param>
        /// <param name="stealth">bool, to check if the ban is a stealth ban.</param>
        /// <param name="oldrank">The rank the who player used to have.</param>
        public static void Banplayer(Player p, string who, string reason, bool stealth, string oldrank)
        {
            // Getting date and time.
            string dayname   = DateTime.Now.DayOfWeek.ToString();
            string daynumber = DateTime.Now.Day.ToString();
            string month     = DateTime.Now.Month.ToString();
            string year      = DateTime.Now.Year.ToString();
            string hour      = DateTime.Now.Hour.ToString();
            string minute    = DateTime.Now.Minute.ToString();
            // Creating date + time string that looks nice to read:
            string datetime = dayname + "%20" + daynumber + "%20" + month + "%20" + year + ",%20at%20" + hour + ":" + minute;
            // checking if p = player or console
            string player;

            if (p == null)
            {
                player = "Console";
            }
            else
            {
                player = p.name;
            }
            // Checking stealth
            string stealthn;

            if (stealth)
            {
                stealthn = "true";
            }
            else
            {
                stealthn = "false";
            }
            if (reason == "")
            {
                reason = "&c-";
            }
            //Write(player, who, reason, stealthn, datetime, oldrank);
            Player toban = Player.Find(who);

            if (toban != null)
            {
                toban.OffenseNote(DateTime.Now, "%0banned%c", reason.Replace("%20", " "), player);
            }
            else
            {
                if (!Directory.Exists("text/offensenotes"))
                {
                    Directory.CreateDirectory("text/offensenotes");
                }
                string path = "text/offensenotes/" + who + ".txt";
                if (!File.Exists(path))
                {
                    File.Create(path).Dispose();
                }
                try
                {
                    StreamWriter sw = File.AppendText(path);
                    sw.WriteLine(DateTime.Now.Day + "." + DateTime.Now.Month + "." + DateTime.Now.Year + ": %0banned%c" + " : " + reason.Replace("%20", " ") + " by " + p.name);
                    sw.Close();
                }
                catch { Server.s.Log("Error saving Offensenote"); }
            }
            if (toban != null)
            {
                toban.Kick("Banned: " + reason.Replace("%20", " "));
            }
        }
Ejemplo n.º 15
0
 public override void Use(Player p, string message)
 {
     if (Server.agreetorulesonentry == false)
     {
         Player.SendMessage(p, "This command can only be used if agree-to-rules-on-entry is enabled in the console!");
         return;
     }
     if (p.group.Permission > LevelPermission.Guest)
     {
         Player.SendMessage(p, "Are you really that stupid to use this command?");
         return;
     }
     if (p == null)
     {
         Player.SendMessage(p, "This command can only be used in-game");
         return;
     }
     p.Kick("Consider agreeing next time =S");
 }
Ejemplo n.º 16
0
 public void Use(Player p, string[] args)
 {
     if (Server.agreed.Contains(p.USERNAME)) { p.SendMessage("You have already agreed to the rules!"); return; }
     if (!p.readrules) { p.SendMessage("You need to read the /rules before you can disagree!"); return; }
     p.Kick("Kicked for disagreeing to the rules!");
 }
Ejemplo n.º 17
0
 public override void Use(Player p, string message)
 {
     p.Kick("Kicked for trying to kick all players from the server!");
 }
Ejemplo n.º 18
0
        public override void Use(Player p, string message)
        {
            string Owner = Server.server_owner;

            if (Server.server_owner == "Notch")
            {
                Owner = "the owner";
            }
            if (p.group.Permission < Server.verifyadminsrank)
            {
                Player.SendMessage(p, "You do not have the &crequired rank to use this command!");
                return;
            }
            if (Server.verifyadmins == false)
            {
                Player.SendMessage(p, "Verification of admins is &cdisabled!");
                return;
            }
            if (p.adminpen == false)
            {
                {
                    Player.SendMessage(p, "You have &calready verified" + Server.DefaultColor + ", why are you using this?");
                    Player.SendMessage(p, "To set a new password use &a/setpass [Pass]!");
                    return;
                }
            }
            if (p.passtries == 3)
            {
                p.Kick("Did you really think you could keep on guessing?");
                return;
            }
            int foundone = 0;

            if (message == "")
            {
                Help(p);
                return;
            }
            int number = message.Split(' ').Length;

            if (number > 1)
            {
                Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!");
                return;
            }
            if (!Directory.Exists("extra/passwords"))
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            DirectoryInfo di = new DirectoryInfo("extra/passwords/");

            FileInfo[] fi = di.GetFiles("*.xml");
            Thread.Sleep(10);
            try
            {
                foreach (FileInfo file in fi)
                {
                    if (file.Name.Replace(".xml", "") == p.name)
                    {
                        foundone++;
                    }
                }
            }
            catch
            {
                Player.SendMessage(p, "An Error Occurred! Try again soon!");
                return;
            }
            if (foundone < 0)
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            if (foundone > 1)
            {
                Player.SendMessage(p, "&cAn error has occurred!");
                return;
            }
            if (!File.Exists("extra/passwords/" + p.name + ".xml"))
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.name + ".xml"), "MCForgeEncryption", p, message);
            if (message == password)
            {
                Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
                if (p.adminpen == true)
                {
                    p.adminpen = false;
                }
                password    = "";
                p.passtries = 0;
                return;
            }
            p.passtries++;
            Player.SendMessage(p, "&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
            Player.SendMessage(p, "If you have &cforgotten your password, " + Server.DefaultColor + "contact " + Owner + " and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.passtries);
            return;
        }