Esempio n. 1
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            Player pl = Player.Find(message);

            if (pl != null && !pl.hidden)
            {
                Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " is online, using /whois instead.");
                Command.all.Find("whois").Use(p, message);
                return;
            }

            if (message.IndexOf("'") != -1)
            {
                Player.SendMessage(p, "Cannot parse request."); return;
            }

            string FoundRank = Group.findPlayer(message.ToLower());

            DataTable playerDb = MySQL.fillData("SELECT * FROM Players WHERE Name='" + message + "'");

            if (playerDb.Rows.Count == 0)
            {
                Player.SendMessage(p, Group.Find(FoundRank).color + message + Server.DefaultColor + " has the rank of " + Group.Find(FoundRank).color + FoundRank); return;
            }

            Player.SendMessage(p, Group.Find(FoundRank).color + playerDb.Rows[0]["Title"] + " " + message + Server.DefaultColor + " has :");
            Player.SendMessage(p, "> > the rank of \"" + Group.Find(FoundRank).color + FoundRank);
            try
            {
                if (!Group.Find("Nobody").commands.Contains("pay") && !Group.Find("Nobody").commands.Contains("give") && !Group.Find("Nobody").commands.Contains("take"))
                {
                    Player.SendMessage(p, "> > &a" + playerDb.Rows[0]["Money"] + Server.DefaultColor + " " + Server.moneys);
                }
            }
            catch { }
            Player.SendMessage(p, "> > &cdied &a" + playerDb.Rows[0]["TotalDeaths"] + Server.DefaultColor + " times");
            Player.SendMessage(p, "> > &bmodified &a" + playerDb.Rows[0]["totalBlocks"] + Server.DefaultColor + " blocks.");
            Player.SendMessage(p, "> > was last seen on &a" + playerDb.Rows[0]["LastLogin"]);
            Player.SendMessage(p, "> > first logged into the server on &a" + playerDb.Rows[0]["FirstLogin"]);
            Player.SendMessage(p, "> > logged in &a" + playerDb.Rows[0]["totalLogin"] + Server.DefaultColor + " times, &c" + playerDb.Rows[0]["totalKicked"] + Server.DefaultColor + " of which ended in a kick.");
            Player.SendMessage(p, "> > " + Awards.awardAmount(message) + " awards");

            bool skip = false;

            if (p != null)
            {
                if (p.group.Permission <= LevelPermission.AdvBuilder)
                {
                    skip = true;
                }
            }

            if (!skip)
            {
                if (Server.bannedIP.Contains(playerDb.Rows[0]["IP"].ToString()))
                {
                    playerDb.Rows[0]["IP"] = "&8" + playerDb.Rows[0]["IP"] + ", which is banned";
                }
                Player.SendMessage(p, "> > the IP of " + playerDb.Rows[0]["IP"]);
                if (Server.useWhitelist)
                {
                    if (Server.whiteList.Contains(message.ToLower()))
                    {
                        Player.SendMessage(p, "> > Player is &fWhitelisted");
                    }
                }
                if (Server.devs.Contains(message.ToLower()))
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer");
                }
            }
            playerDb.Dispose();
        }
Esempio n. 2
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;
            }
        }