private void buttonRemove_Click(object sender, EventArgs e)
 {
     Economy.Settings.LevelsList.Remove(Economy.FindLevel(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()));
     dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);
     buttonRemove.Enabled = checkBoxLevel.Checked && dataGridView1.SelectedRows.Count > 0;
     buttonEdit.Enabled   = checkBoxLevel.Checked && dataGridView1.SelectedRows.Count > 0;
 }
Exemple #2
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (edit)
     {
         Economy.Settings.LevelsList.Remove(Economy.FindLevel(lvledit.oldname));
     }
     Economy.Settings.Level level = new Economy.Settings.Level();
     level.name  = textBoxName.Text.Split()[0];
     level.price = (int)numericUpDownPrice.Value;
     level.x     = comboBoxX.SelectedItem.ToString();
     level.y     = comboBoxY.SelectedItem.ToString();
     level.z     = comboBoxZ.SelectedItem.ToString();
     level.type  = comboBoxType.SelectedItem.ToString().ToLower();
     Economy.Settings.LevelsList.Add(level);
     eco.UpdateLevels();
     eco.CheckLevelEnables();
     this.Close();
 }
        public void Use(Player p, string[] args)
        {
            //TODO: Zoning after buying a level
            Economy.Load();
            int ln = args.Length;

            switch (args[0].ToLower())
            {
                #region Setup
            case "setup":
            case "set":
                if (!(p is ConsolePlayer))
                {
                    if (p.Group.Permission < Economy.SetupPermission)
                    {
                        p.SendMessage("You do not have permission to use /economy setup!"); return;
                    }
                }
                if (!cargs(p, ln, 2))
                {
                    return;
                }
                switch (args[1].ToLower())
                {
                case "economy":
                case "eco":
                    if (!cargs(p, ln, 3))
                    {
                        return;
                    }
                    switch (args[2].ToLower())
                    {
                    case "enable":
                    case "on":
                        if (!Economy.Enabled)
                        {
                            Economy.Enabled = true;
                            p.SendMessage("Economy successfully enabled.");
                        }
                        else
                        {
                            p.SendMessage("Economy is already enabled!");
                        }
                        break;

                    case "disable":
                    case "off":
                        if (Economy.Enabled)
                        {
                            Economy.Enabled = false;
                            p.SendMessage("Economy successfully enabled.");
                        }
                        else
                        {
                            p.SendMessage("Economy is already enabled!");
                        }
                        break;

                    default:
                        p.SendMessage("Invalid option!");
                        return;
                    }
                    break;

                    #region Color
                case "color":
                case "colors":
                case "colour":
                case "colours":
                    if (!cargs(p, ln, 3))
                    {
                        return;
                    }
                    switch (args[2].ToLower())
                    {
                    case "enable":
                    case "on":
                        if (!Economy.ColorsEnabled)
                        {
                            Economy.ColorsEnabled = true;
                            p.SendMessage("Colors successfully enabled.");
                        }
                        else
                        {
                            p.SendMessage("Colors are already enabled!");
                        }
                        break;

                    case "disable":
                    case "off":
                        if (Economy.ColorsEnabled)
                        {
                            Economy.ColorsEnabled = false;
                            p.SendMessage("Colors successfully disabled.");
                        }
                        else
                        {
                            p.SendMessage("Colors are already disabled!");
                        }
                        break;

                    case "price":
                    case "cost":
                        if (!cargs(p, ln, 4))
                        {
                            return;
                        }
                        if (!CheckPrice(p, args[3]))
                        {
                            return;
                        }
                        Economy.ColorPrice = int.Parse(args[3]);
                        p.SendMessage("Color price successfully set to &3" + args[3] + " " + Server.DefaultColor + Server.Moneys + ".");
                        break;

                    default:
                        p.SendMessage("Invalid option!");
                        return;
                    }
                    break;

                    #endregion
                    #region Title
                case "title":
                case "titles":
                    switch (args[2].ToLower())
                    {
                    case "enable":
                    case "on":
                        if (!Economy.TitlesEnabled)
                        {
                            Economy.TitlesEnabled = true;
                            p.SendMessage("Titles successfully enabled.");
                        }
                        else
                        {
                            p.SendMessage("Titles are already enabled!");
                        }
                        break;

                    case "disable":
                    case "off":
                        if (Economy.TitlesEnabled)
                        {
                            Economy.TitlesEnabled = false;
                            p.SendMessage("Titles successfully disabled.");
                        }
                        else
                        {
                            p.SendMessage("Titles are already disabled!");
                        }
                        break;

                    case "price":
                    case "cost":
                        if (!CheckPrice(p, args[3]))
                        {
                            return;
                        }
                        Economy.TitlePrice = int.Parse(args[3]);
                        p.SendMessage("Title price successfully set to &3" + args[3] + " " + Server.DefaultColor + Server.Moneys + ".");
                        break;

                    default:
                        p.SendMessage("Invalid option!");
                        return;
                    }
                    break;

                    #endregion
                    #region Level
                case "level":
                case "levels":
                case "world":
                case "worlds":
                case "map":
                case "maps":
                    if (!cargs(p, ln, 3))
                    {
                        return;
                    }
                    Economy.Level lvl = new Economy.Level();
                    switch (args[2].ToLower())
                    {
                    case "enable":
                    case "on":
                        if (!Economy.LevelsEnabled)
                        {
                            Economy.LevelsEnabled = true;
                            p.SendMessage("Levels successfully enabled.");
                        }
                        else
                        {
                            p.SendMessage("Levels are already enabled!");
                        }
                        break;

                    case "disable":
                    case "off":
                        if (Economy.LevelsEnabled)
                        {
                            Economy.LevelsEnabled = false;
                            p.SendMessage("Levels successfully disabled.");
                        }
                        else
                        {
                            p.SendMessage("Levels are already disabled!");
                        }
                        break;

                    case "add":
                    case "create":
                    case "new":
                        if (!cargs(p, ln, 9))
                        {
                            return;
                        }
                        if (!CheckPrice(p, args[8]))
                        {
                            return;
                        }
                        if (!Valid(args[4]) || !Valid(args[5]) || !Valid(args[6]))
                        {
                            p.SendMessage("Invalid level size!"); return;
                        }
                        if (Economy.LevelExists(args[3]))
                        {
                            p.SendMessage("A level named \"" + args[3] + "\" already exists in the economy level list. To rename or edit said level entry, use &a/economy setup level edit <old name> <new name> <new x> <new y> <new z> <new type> <new price>" + Server.DefaultColor + "."); return;
                        }
                        lvl.Name  = args[3].ToLower();
                        lvl.X     = args[4];
                        lvl.Y     = args[5];
                        lvl.Z     = args[6];
                        lvl.Type  = args[7].ToLower();
                        lvl.Price = int.Parse(args[8]);
                        Economy.LevelList.Add(lvl);
                        p.SendMessage("Successfully added the level preset \"" + args[3] + "\".");
                        lvl = null;
                        break;

                    case "delete":
                    case "remove":
                    case "del":
                        if (!cargs(p, ln, 4))
                        {
                            return;
                        }
                        if (!Economy.LevelExists(args[3]))
                        {
                            p.SendMessage("Level \"" + args[3] + "\" is not in the economy level list!"); return;
                        }
                        Economy.LevelList.Remove(lvl);
                        p.SendMessage("Level preset \"" + lvl.Name + "\" successfully deleted");
                        break;

                    case "edit":
                    case "change":
                        if (!cargs(p, ln, 10))
                        {
                            return;
                        }
                        if (!CheckPrice(p, args[9]))
                        {
                            return;
                        }
                        if (!Valid(args[5]) || !Valid(args[6]) || !Valid(args[7]))
                        {
                            p.SendMessage("Invalid level size!"); return;
                        }
                        if (!Economy.LevelExists(args[3]))
                        {
                            p.SendMessage("Level \"" + args[3] + "\" is not in the economy level list!"); return;
                        }
                        Economy.LevelList.Remove(Economy.FindLevel(args[3]));
                        lvl       = new Economy.Level();
                        lvl.Name  = args[4];
                        lvl.X     = args[5];
                        lvl.Y     = args[6];
                        lvl.Z     = args[7];
                        lvl.Type  = args[8];
                        lvl.Price = int.Parse(args[9]);
                        Economy.LevelList.Add(lvl);
                        if (args[3] != args[4])
                        {
                            p.SendMessage("Level \"" + args[3] + "\" successfully edited and/or renamed to \"" + args[4] + "\".");
                        }
                        if (args[3] == args[4])
                        {
                            p.SendMessage("Level \"" + args[3] + "\" successfully edited.");
                        }
                        break;

                    default:
                        p.SendMessage("Invalid option!");
                        return;
                    }
                    break;

                    #endregion
                    #region Rank
                case "rank":
                case "ranks":
                case "group":
                case "groups":
                case "promotion":
                case "promotions":
                    if (!cargs(p, ln, 3))
                    {
                        return;
                    }
                    PlayerGroup  group;
                    Economy.Rank rank;
                    switch (args[2].ToLower())
                    {
                    case "enable":
                    case "on":
                        if (!Economy.RanksEnabled)
                        {
                            Economy.RanksEnabled = true;
                            p.SendMessage("Ranks successfully enabled.");
                        }
                        else
                        {
                            p.SendMessage("Ranks are already enabled!");
                        }
                        break;

                    case "disable":
                    case "off":
                        if (Economy.RanksEnabled)
                        {
                            Economy.RanksEnabled = false;
                            p.SendMessage("Ranks successfully disabled.");
                        }
                        else
                        {
                            p.SendMessage("Ranks are already disabled!");
                        }
                        break;

                    case "add":
                    case "create":
                        if (!cargs(p, ln, 5))
                        {
                            return;
                        }
                        if (!CheckPrice(p, args[4]))
                        {
                            return;
                        }
                        if (Economy.RankExists(args[3]))
                        {
                            p.SendMessage("The rank \"" + args[3] + "\" is already in the economy system. To edit said rank entry, use &a/economy setup rank edit <rank name> <new price>" + Server.DefaultColor + "."); return;
                        }
                        group = PlayerGroup.Find(args[3]);
                        if (group == null)
                        {
                            p.SendMessage("Rank \"" + args[3] + "\" not found!"); return;
                        }
                        rank       = new Economy.Rank();
                        rank.Group = group;
                        rank.Price = int.Parse(args[4]);
                        Economy.RankList.Add(rank);
                        p.SendMessage("Rank \"" + rank.Group.Name + "\" added to the economy system with the price set to " + rank.Price + ".");
                        rank  = null;
                        group = null;
                        break;

                    case "remove":
                    case "delete":
                    case "del":
                        if (!cargs(p, ln, 4))
                        {
                            return;
                        }
                        if (!Economy.RankExists(args[3]))
                        {
                            p.SendMessage("The rank \"" + args[3] + "\" is not in the economy system."); return;
                        }
                        Economy.RankList.Remove(Economy.FindRank(args[3]));
                        p.SendMessage("Rank \"" + args[3] + "\" successfully removed from the economy system.");
                        break;

                    case "edit":
                    case "change":
                        if (!cargs(p, ln, 5))
                        {
                            return;
                        }
                        if (!CheckPrice(p, args[4]))
                        {
                            return;
                        }
                        if (!Economy.RankExists(args[3]))
                        {
                            p.SendMessage("The rank \"" + args[3] + "\" is not in the economy system."); return;
                        }
                        group = PlayerGroup.Find(args[3]);
                        if (group == null)
                        {
                            p.SendMessage("Rank \"" + args[3] + "\" not found!"); return;
                        }
                        Economy.RankList.Remove(Economy.FindRank(args[3]));
                        rank       = new Economy.Rank();
                        rank.Group = group;
                        rank.Price = int.Parse(args[4]);
                        Economy.RankList.Add(rank);
                        p.SendMessage("Price for rank \"" + args[3] + "\" set to &3" + args[4] + " " + Server.DefaultColor + Server.Moneys + ".");
                        rank  = null;
                        group = null;
                        break;

                    default:
                        p.SendMessage("Invalid option!");
                        return;
                    }
                    break;

                    #endregion
                default:
                    p.SendMessage("Invalid option!");
                    return;
                }
                Economy.Save();
                break;

                #endregion
                #region Info
            case "info":
            case "information":
                if (!cargs(p, ln, 2))
                {
                    return;
                }
                switch (args[1].ToLower())
                {
                case "color":
                case "colors":
                case "colour":
                case "colours":
                    p.SendMessage("Colors cost &3" + Economy.ColorPrice + " " + Server.DefaultColor + Server.Moneys + ".");
                    break;

                case "title":
                case "titles":
                    p.SendMessage("Titles cost &3" + Economy.ColorPrice + " " + Server.DefaultColor + Server.Moneys + ".");
                    break;

                case "level":
                case "levels":
                case "map":
                case "maps":
                case "world":
                case "worlds":
                    /*foreach (Economy.Level lvl in Economy.LevelList)
                     * {
                     *  p.SendMessage("&a" + lvl.Name + ": &9Size: " + lvl.X + "&2x&9" + lvl.Y + "&2x&9" + lvl.Z + " &6Type: " + lvl.Type + " &3Price: " + lvl.Price);
                     * }*/
                    if (!cargs(p, ln, 3))
                    {
                        return;
                    }
                    if (string.IsNullOrEmpty(args[2]))
                    {
                        args[2] = "1";
                    }
                    List <Economy.Level> list = Economy.LevelList;
                    int Page = 0;
                    try { Page = int.Parse(args[2]); }
                    catch { p.SendMessage("Invalid number!"); return; }
                    int Pages = 0;
                    if (list.Count % 10 > 0)
                    {
                        Pages = (list.Count / 10) + 1;
                    }
                    else
                    {
                        Pages = list.Count / 10;
                    }
                    if (Page > Pages)
                    {
                        p.SendMessage("You can't view page &3" + Page + Server.DefaultColor + ", there are only &a" + Pages + Server.DefaultColor + " pages!"); return;
                    }
                    p.SendMessage("Page &3" + Page + Server.DefaultColor + " of &a" + Pages);
                    for (int i = 0; i <= list.Count; i++)
                    {
                        if (list.Count / i == Page)
                        {
                            p.SendMessage("&a" + list[i].Name + ": &9Size: " + list[i].X + "&2x&9" + list[i].Y + "&2x&9" + list[i].Z + " &6Type: " + list[i].Type + " &3Price: " + list[i].Price);
                        }
                    }
                    break;

                case "rank":
                case "ranks":
                case "promotion":
                case "promotions":
                case "group":
                case "groups":
                    foreach (Economy.Rank R in Economy.RankList)
                    {
                        p.SendMessage(R.Group.Color + R.Group.Name + Server.DefaultColor + ", Price: &3" + R.Price);
                    }
                    break;
                }
                break;

                #endregion
                #region Buy
            case "buy":
                if (!Economy.Enabled)
                {
                    p.SendMessage("Economy is not enabled!"); return;
                }
                if (!cargs(p, ln, 2))
                {
                    return;
                }
                switch (args[1].ToLower())
                {
                    #region Title
                case "title":
                    if (!cargs(p, ln, 3))
                    {
                        return;
                    }
                    if (!Economy.TitlesEnabled)
                    {
                        p.SendMessage("Titles are not enabled for the economy system!"); return;
                    }
                    if (!CanAfford(p, Economy.TitlePrice))
                    {
                        return;
                    }
                    p.ExtraData["Money"] = (int)p.ExtraData["Money"] - Economy.TitlePrice;
                    Command.Find("title").Use(null, new string[] { p.Username, args[2] });
                    break;

                    #endregion
                    #region Color
                case "color":
                case "colour":
                    if (!cargs(p, ln, 3))
                    {
                        return;
                    }
                    if (!Economy.ColorsEnabled)
                    {
                        p.SendMessage("Titles are not enabled for the economy system!"); return;
                    }
                    if (!CanAfford(p, Economy.ColorPrice))
                    {
                        return;
                    }
                    p.ExtraData["Money"] = (int)p.ExtraData["Money"] - Economy.ColorPrice;
                    Command.Find("color").Use(null, new string[] { p.Username, args[2] });
                    break;

                    #endregion
                    #region Level
                case "level":
                case "map":
                case "world":
                    if (!cargs(p, ln, 4))
                    {
                        return;
                    }
                    Economy.Level lvl = Economy.FindLevel(args[2]);
                    if (lvl == null)
                    {
                        p.SendMessage("Level \"" + args[2] + "\" is not in the economy levels list!"); return;
                    }
                    if (!CanAfford(p, lvl.Price))
                    {
                        return;
                    }
                    p.ExtraData["Money"] = (int)p.ExtraData["Money"] - lvl.Price;
                    Command.Find("newlvl").Use(null, new string[] { args[3], lvl.X, lvl.Z, lvl.Y, lvl.Type });
                    //System.Threading.Thread.Sleep(1000);
                    Command.Find("goto").Use(p, new string[] { args[3] });
                    break;

                    #endregion
                    #region Rank
                case "rank":
                case "promotion":
                    if (!cargs(p, ln, 3))
                    {
                        return;
                    }
                    Economy.Rank rank = Economy.FindRank(args[2]);
                    if (rank == null)
                    {
                        p.SendMessage("Rank \"" + args[2] + "\" is not in the economy ranks list."); return;
                    }
                    if (!CanAfford(p, rank.Price))
                    {
                        return;
                    }
                    if (rank.Group.Permission <= p.Group.Permission)
                    {
                        p.SendMessage("You cannot purchase a rank with a permission lower than your own!"); return;
                    }
                    p.ExtraData["Money"] = (int)p.ExtraData["Money"] - rank.Price;
                    rank.Group.AddPlayer(p);
                    Player.UniversalChat(p.Color + p.Username + Server.DefaultColor + " has purchased the rank " + rank.Group.Color + rank.Group.Name + Server.DefaultColor + " for &3" + rank.Price + " " + Server.DefaultColor + Server.Moneys + "!");
                    break;
                    #endregion
                }
                break;

                #endregion
                #region Help
            case "help":
                if (!cargs(p, ln, 2))
                {
                    return;
                }
                string msg = "";
                foreach (string arg in args)
                {
                    if (arg != args[0])
                    {
                        msg += arg + " ";
                    }
                }
                msg = msg.Trim().ToLower();
                if (msg.StartsWith("info") || msg.StartsWith("information"))
                {
                    p.SendMessage("/eco info <color/title/level/rank> - Gives you information and pricing for the selected option.");
                }
                switch (msg)
                {
                    #region Setup
                case "setup":
                    p.SendMessage("/eco setup economy <enable/disable> - Enable or disable economy.");
                    p.SendMessage("/eco setup color <enable/disable/price> - Enable, disable, or set the price of colors.");
                    p.SendMessage("/eco setup title <enable/disable/price> - Enable, disable, or set the price of titles.");
                    p.SendMessage("/eco setup level <add/delete/edit> - Add, delete, or edit buy-able levels.");
                    p.SendMessage("/eco setup rank <add/delete/edit> - Add, delete, or edit buy-able ranks.");
                    p.SendMessage("&aUse /eco help setup <color/title/level/rank> for more specific help.");
                    break;

                case "setup economy":
                    p.SendMessage("/eco setup economy <enable/disable> - Enable or disable economy.");
                    break;

                    #region Color
                case "setup color":
                    p.SendMessage("&3/eco setup color");
                    p.SendMessage("enable - Enables colors for the economy system.");
                    p.SendMessage("disable - Disables colors for the economy system.");
                    p.SendMessage("price <amount> - Sets the price of a color to <amount>.");
                    break;

                case "setup color enable":
                    p.SendMessage("/eco setup color enable - Enables colors for the economy system.");
                    break;

                case "setup color disable":
                    p.SendMessage("/eco setup color disable - Disables colors for the economy system.");
                    break;

                case "setup color price":
                case "setup color cost":
                    p.SendMessage("/eco setup color price <amount> - Sets the price of a color to <amount>.");
                    break;

                    #endregion
                    #region Title
                case "setup title":
                    p.SendMessage("&3/eco setup title");
                    p.SendMessage("enable - Enables titles for the economy system.");
                    p.SendMessage("disable - Disables titles for the economy system.");
                    p.SendMessage("price <amount> - Sets the price of a title to <amount>.");
                    break;

                case "setup title enable":
                    p.SendMessage("/eco setup title enable - Enables titles for the economy system.");
                    break;

                case "setup title disable":
                    p.SendMessage("/eco setup title disable - Disables titles for the economy system.");
                    break;

                case "setup title price":
                case "setup title cost":
                    p.SendMessage("/eco setup title price <amount> - Sets the price of a title to <amount>.");
                    break;

                    #endregion
                    #region Level
                case "setup level":
                    p.SendMessage("&3/eco setup level");
                    p.SendMessage("add <name> <X> <Y> <Z> <type> <price> - Adds a level preset named <name> with size values <X>, <Y>, <Z>, and type <type> to the economy system at a price of <price>.");
                    p.SendMessage("delete <name> - Deletes a level preset named <name>.");
                    p.SendMessage("edit <old name> <new name> <X> <Y> <Z> <type> <price> - Edits the level preset named <old name> to have the size values <X>, <Y>, <Z>, and type <type> at price <price>. If <new name> is different than <old name>, the preset will be renamed.");
                    break;

                case "setup level add":
                case "setup level create":
                case "setup level new":
                    p.SendMessage("/eco setup level add <name> <X> <Y> <Z> <type> <price> - Adds a level preset named <name> with size values <X>, <Y>, <Z>, and type <type> to the economy system at a price of <price>.");
                    break;

                case "setup level delete":
                case "setup level remove":
                case "setup level del":
                    p.SendMessage("/eco setup level delete <name> - Deletes a level preset named <name>.");
                    break;

                case "setup level edit":
                case "setup level change":
                    p.SendMessage("/eco setup level edit <old name> <new name> <X> <Y> <Z> <type> <price> - Edits the level preset named <old name> to have the size values <X>, <Y>, <Z>, and type <type> at price <price>. If <new name> is different than <old name>, the preset will be renamed.");
                    break;

                    #endregion
                    #region Rank
                case "setup rank":
                    p.SendMessage("&3/eco setup rank");
                    p.SendMessage("add <rank> <price> - Allows <rank> to be purchased for <price> " + Server.Moneys + ".");
                    p.SendMessage("delete <rank> - Removes <rank> from the economy ranks list.");
                    p.SendMessage("edit <rank> <new price> - Changes the price of <rank> to <new price>.");
                    break;

                case "setup rank add":
                case "setup rank new":
                case "setup rank create":
                    p.SendMessage("/eco setup rank add <rank> <price> - Allows <rank> to be purchased for <price> " + Server.Moneys + ".");
                    break;

                case "setup rank delete":
                case "setup rank remove":
                case "setup rank del":
                    p.SendMessage("/eco delete <rank> - Removes <rank> from the economy ranks list.");
                    break;

                case "setup rank edit":
                case "setup rank change":
                    p.SendMessage("/eco edit <rank> <new price> - Changes the price of <rank> to <new price>.");
                    break;

                    #endregion
                    #endregion
                    #region Buy
                case "buy":
                    p.SendMessage("/eco buy <color/title/level/rank> - Buy a color, title, level, or rank.");
                    p.SendMessage("&aUse /eco help buy <color/title/level/rank> for more specific help.");
                    break;

                case "buy color":
                    p.SendMessage("/eco buy color <color> - Buy and apply the selected color.");
                    break;

                case "buy title":
                    p.SendMessage("/eco buy title <title> - Buy and apply the selected title.");
                    break;

                case "buy level":
                    p.SendMessage("/eco buy level <level> - Buy <level>. (The level will be zoned for you automatically.)");
                    break;

                case "buy rank":
                    p.SendMessage("/eco buy rank <rank> - Buy <rank>.");
                    break;

                    #endregion
                default:
                    p.SendMessage("Invalid option!");
                    return;
                }
                break;

            default:
                p.SendMessage("Invalid option!");
                return;

                #endregion
            }
        }
Exemple #4
0
        public override void Use(Player p, string message)
        {
            string[] command = message.Trim().Split(' ');
            string   par0    = String.Empty;
            string   par1    = String.Empty;
            string   par2    = String.Empty;
            string   par3    = String.Empty;
            string   par4    = String.Empty;
            string   par5    = String.Empty;
            string   par6    = String.Empty;
            string   par7    = String.Empty;
            string   par8    = String.Empty;

            try
            {
                par0 = command[0].ToLower();
                par1 = command[1].ToLower();
                par2 = command[2];
                par3 = command[3];
                par4 = command[4];
                par5 = command[5];
                par6 = command[6];
                par7 = command[7];
                par8 = command[8];
            }
            catch { }

            switch (par0)
            {
            case "setup":
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
                {
                    switch (par1)
                    {
                    case "maps":
                    case "levels":
                    case "map":
                    case "level":
                        Economy.Settings.Level lvl = Economy.FindLevel(par3);
                        switch (par2)
                        {
                        case "new":
                        case "create":
                        case "add":
                            if (Economy.FindLevel(par3) != null)
                            {
                                Player.SendMessage(p, "That preset level already exists"); break;
                            }
                            else
                            {
                                Economy.Settings.Level level = new Economy.Settings.Level();
                                level.name = par3;
                                if (isGood(par4))
                                {
                                    level.x = par4;
                                }
                                if (isGood(par5))
                                {
                                    level.y = par5;
                                }
                                if (isGood(par6))
                                {
                                    level.z = par6;
                                }
                                else
                                {
                                    Player.SendMessage(p, "A Dimension was wrong, it must a power of 2"); break;
                                }
                                switch (par7.ToLower())
                                {
                                case "flat":
                                case "pixel":
                                case "island":
                                case "mountains":
                                case "ocean":
                                case "forest":
                                case "desert":
                                case "space":
                                    level.type = par7.ToLower();
                                    break;

                                default:
                                    Player.SendMessage(p, "Valid types: island, mountains, forest, ocean, flat, pixel, desert, space");
                                    break;
                                }
                                level.price = int.Parse(par8);
                                Economy.Settings.LevelsList.Add(level);
                                Player.SendMessage(p, "Added map to presets");
                                break;
                            }

                        case "delete":
                        case "remove":
                            if (lvl == null)
                            {
                                Player.SendMessage(p, "That preset level doesn't exist"); break;
                            }
                            else
                            {
                                Economy.Settings.LevelsList.Remove(lvl); Player.SendMessage(p, "Removed preset"); break;
                            }

                        case "edit":
                        case "change":
                            if (lvl == null)
                            {
                                Player.SendMessage(p, "That preset level doesn't exist"); break;
                            }
                            else
                            {
                                switch (par4)
                                {
                                case "name":
                                case "title":
                                    Economy.Settings.LevelsList.Remove(lvl);
                                    lvl.name = par5;
                                    Economy.Settings.LevelsList.Add(lvl);
                                    Player.SendMessage(p, "Changed preset name");
                                    break;

                                case "x":
                                    if (isGood(par5))
                                    {
                                        Economy.Settings.LevelsList.Remove(lvl);
                                        lvl.x = par5;
                                        Economy.Settings.LevelsList.Add(lvl);
                                        Player.SendMessage(p, "Changed preset x size");
                                    }
                                    else
                                    {
                                        Player.SendMessage(p, "Dimension was wrong, it must a power of 2"); break;
                                    }
                                    break;

                                case "y":
                                    if (isGood(par5))
                                    {
                                        Economy.Settings.LevelsList.Remove(lvl);
                                        lvl.y = par5;
                                        Economy.Settings.LevelsList.Add(lvl);
                                        Player.SendMessage(p, "Changed preset y size");
                                    }
                                    else
                                    {
                                        Player.SendMessage(p, "Dimension was wrong, it must a power of 2"); break;
                                    }
                                    break;

                                case "z":
                                    if (isGood(par5))
                                    {
                                        Economy.Settings.LevelsList.Remove(lvl);
                                        lvl.z = par5;
                                        Economy.Settings.LevelsList.Add(lvl);
                                        Player.SendMessage(p, "Changed preset z size");
                                    }
                                    else
                                    {
                                        Player.SendMessage(p, "Dimension was wrong, it must a power of 2"); break;
                                    }
                                    break;

                                case "type":
                                    Economy.Settings.LevelsList.Remove(lvl);
                                    switch (par5.ToLower())
                                    {
                                    case "flat":
                                    case "pixel":
                                    case "island":
                                    case "mountains":
                                    case "ocean":
                                    case "forest":
                                    case "desert":
                                    case "space":
                                        lvl.type = par5.ToLower();
                                        break;

                                    default:
                                        Player.SendMessage(p, "Valid types: island, mountains, forest, ocean, flat, pixel, desert, space");
                                        Economy.Settings.LevelsList.Add(lvl);
                                        break;
                                    }
                                    Economy.Settings.LevelsList.Add(lvl);
                                    Player.SendMessage(p, "Changed preset type");
                                    break;

                                case "dimensions":
                                case "sizes":
                                case "dimension":
                                case "size":
                                    Economy.Settings.LevelsList.Remove(lvl);
                                    if (isGood(par4))
                                    {
                                        lvl.x = par4;
                                    }
                                    if (isGood(par5))
                                    {
                                        lvl.y = par5;
                                    }
                                    if (isGood(par6))
                                    {
                                        lvl.z = par6;
                                    }
                                    else
                                    {
                                        Player.SendMessage(p, "A Dimension was wrong, it must a power of 2"); Economy.Settings.LevelsList.Add(lvl); break;
                                    }
                                    Economy.Settings.LevelsList.Add(lvl);
                                    Player.SendMessage(p, "Changed preset name");
                                    break;

                                case "price":
                                    Economy.Settings.LevelsList.Remove(lvl);
                                    lvl.price = int.Parse(par5);
                                    Economy.Settings.LevelsList.Add(lvl);
                                    Player.SendMessage(p, "Changed preset price");
                                    break;

                                default:
                                    Player.SendMessage(p, "That wasn't a valid command addition");
                                    break;
                                }
                            }
                            break;

                        case "enable":
                            if (Economy.Settings.Levels == true)
                            {
                                Player.SendMessage(p, "Maps are already enabled for the economy system"); break;
                            }
                            else
                            {
                                Economy.Settings.Levels = true; Player.SendMessage(p, "Maps are now enabled for the economy system"); break;
                            }

                        case "disable":
                            if (Economy.Settings.Levels == false)
                            {
                                Player.SendMessage(p, "Maps are already disabled for the economy system"); break;
                            }
                            else
                            {
                                Economy.Settings.Levels = false; Player.SendMessage(p, "Maps are now disabled for the economy system"); break;
                            }

                        default:
                            Player.SendMessage(p, "That wasn't a valid command addition");
                            break;
                        }
                        break;

                    case "titles":
                    case "title":
                        switch (par2)
                        {
                        case "enable":
                            if (Economy.Settings.Titles == true)
                            {
                                Player.SendMessage(p, "Titles are already enabled for the economy system"); break;
                            }
                            else
                            {
                                Economy.Settings.Titles = true; Player.SendMessage(p, "Titles are now enabled for the economy system"); break;
                            }

                        case "disable":
                            if (Economy.Settings.Titles == false)
                            {
                                Player.SendMessage(p, "Titles are already disabled for the economy system"); break;
                            }
                            else
                            {
                                Economy.Settings.Titles = false; Player.SendMessage(p, "Titles are now disabled for the economy system"); break;
                            }

                        case "price":
                            Economy.Settings.TitlePrice = int.Parse(par3);
                            Player.SendMessage(p, "Changed title price");
                            break;

                        default:
                            Player.SendMessage(p, "That wasn't a valid command addition");
                            break;
                        }
                        break;

                    case "colors":
                    case "colours":
                    case "color":
                    case "colour":
                        switch (par2)
                        {
                        case "enable":
                            if (Economy.Settings.Colors == true)
                            {
                                Player.SendMessage(p, "Colors are already enabled for the economy system"); break;
                            }
                            else
                            {
                                Economy.Settings.Colors = true; Player.SendMessage(p, "Colors are now enabled for the economy system"); break;
                            }

                        case "disable":
                            if (Economy.Settings.Colors == false)
                            {
                                Player.SendMessage(p, "Colors are already disabled for the economy system"); break;
                            }
                            else
                            {
                                Economy.Settings.Colors = false; Player.SendMessage(p, "Colors are now disabled for the economy system"); break;
                            }

                        case "price":
                            Economy.Settings.ColorPrice = int.Parse(par3);
                            Player.SendMessage(p, "Changed color price");
                            break;

                        default:
                            Player.SendMessage(p, "That wasn't a valid command addition");
                            break;
                        }
                        break;

                    case "ranks":
                    case "rank":
                        switch (par2)
                        {
                        case "enable":
                            if (Economy.Settings.Ranks == true)
                            {
                                Player.SendMessage(p, "Ranks are already enabled for the economy system"); break;
                            }
                            else
                            {
                                Economy.Settings.Ranks = true; Player.SendMessage(p, "Ranks are now enabled for the economy system"); break;
                            }

                        case "disable":
                            if (Economy.Settings.Ranks == false)
                            {
                                Player.SendMessage(p, "Ranks are already disabled for the economy system"); break;
                            }
                            else
                            {
                                Economy.Settings.Ranks = false; Player.SendMessage(p, "Ranks are now disabled for the economy system"); break;
                            }

                        case "price":
                            Economy.Settings.Rank rnk = Economy.FindRank(par3);
                            if (rnk == null)
                            {
                                Player.SendMessage(p, "That isn't a rank or it's past the max rank"); break;
                            }
                            else
                            {
                                rnk.price = int.Parse(par4);
                                Player.SendMessage(p, "Changed rank price for " + rnk.group.name);
                                break;
                            }

                        case "maxrank":
                        case "max":
                        case "maximum":
                        case "maximumrank":
                            Group grp = Group.Find(par3);
                            if (grp == null)
                            {
                                Player.SendMessage(p, "That isn't a rank!!"); break;
                            }
                            else
                            {
                                Economy.Settings.MaxRank = grp.Permission; Player.SendMessage(p, "Set max rank");
                                int lasttrueprice = 0;
                                foreach (Group group in Group.GroupList)
                                {
                                    if (group.Permission > grp.Permission)
                                    {
                                        break;
                                    }
                                    if (!(group.Permission <= Group.Find(Server.defaultRank).Permission))
                                    {
                                        Economy.Settings.Rank rank = new Economy.Settings.Rank();
                                        rank = Economy.FindRank(group.name);
                                        if (rank == null)
                                        {
                                            rank       = new Economy.Settings.Rank();
                                            rank.group = group;
                                            if (lasttrueprice == 0)
                                            {
                                                rank.price = 1000;
                                            }
                                            else
                                            {
                                                rank.price = lasttrueprice + 250;
                                            }
                                            Economy.Settings.RanksList.Add(rank);
                                        }
                                        else
                                        {
                                            lasttrueprice = rank.price;
                                        }
                                    }
                                }
                                break;
                            }

                        default:
                            Player.SendMessage(p, "That wasn't a valid command addition");
                            break;
                        }
                        break;

                    case "enable":
                        if (Economy.Settings.Enabled == true)
                        {
                            Player.SendMessage(p, "The economy system is already enabled"); return;
                        }
                        else
                        {
                            Economy.Settings.Enabled = true; Player.SendMessage(p, "The economy system is now enabled"); return;
                        }

                    case "disable":
                        if (Economy.Settings.Enabled == false)
                        {
                            Player.SendMessage(p, "The economy system is already disabled"); return;
                        }
                        else
                        {
                            Economy.Settings.Enabled = false; Player.SendMessage(p, "The economy system is now disabled"); return;
                        }

                    default:
                        Player.SendMessage(p, "That wasn't a valid command addition");
                        return;
                    }
                    Economy.Save();
                    return;
                }
                else
                {
                    Player.SendMessage(p, "You aren't a high enough rank for that"); return;
                }



            case "buy":
                switch (par1)
                {
                case "map":
                case "level":
                case "maps":
                case "levels":
                    Economy.Settings.Level lvl = Economy.FindLevel(par2);
                    if (lvl == null)
                    {
                        Player.SendMessage(p, "That isn't a level preset"); return;
                    }
                    else
                    {
                        if (p.EnoughMoney(lvl.price) == false)
                        {
                            Player.SendMessage(p, "You don't have enough " + Server.moneys + " to buy that map"); return;
                        }
                        else
                        {
                            if (par3 == null)
                            {
                                Player.SendMessage(p, "You didn't specify a name for your level"); return;
                            }
                            else
                            {
                                int old = p.money;
                                try
                                {
                                    Command.all.Find("newlvl").Use(null, p.name + "_" + par3 + " " + lvl.x + " " + lvl.y + " " + lvl.z + " " + lvl.type);
                                    Player.SendMessage(p, "Created level '" + p.name + "_" + par3 + "'");
                                    p.money = p.money - lvl.price;
                                    Player.SendMessage(p, "Your balance is now " + p.money.ToString() + " " + Server.moneys);
                                    Command.all.Find("load").Use(null, p.name + "_" + par3);
                                    Thread.Sleep(250);
                                    Level level = Level.Find(p.name + "_" + par3);
                                    if (level.permissionbuild > p.group.Permission)
                                    {
                                        level.permissionbuild = p.group.Permission;
                                    }
                                    if (level.permissionvisit > p.group.Permission)
                                    {
                                        level.permissionvisit = p.group.Permission;
                                    }
                                    Command.all.Find("goto").Use(p, p.name + "_" + par3);
                                    while (p.Loading)
                                    {
                                        Thread.Sleep(250);
                                    }
                                    try
                                    {
                                        //DB
                                        if (Server.useMySQL)
                                        {
                                            MySQL.executeQuery("INSERT INTO `Zone" + level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (0,0,0," + (level.width - 1) + "," + (level.depth - 1) + "," + (level.height - 1) + ",'" + p.name + "')");
                                        }
                                        else
                                        {
                                            SQLite.executeQuery("INSERT INTO `Zone" + level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (0,0,0," + (level.width - 1) + "," + (level.depth - 1) + "," + (level.height - 1) + ",'" + p.name + "')");                                                                                                                                                                                                                                                            //CHECK!!!!
                                        }
                                        //DB
                                        Player.SendMessage(p, "Zoning Succesful");
                                        return;
                                    }
                                    catch { Player.SendMessage(p, "Zoning Failed"); return; }
                                }
                                catch { Player.SendMessage(p, "Something went wrong, Money restored"); if (old != p.money)
                                        {
                                            p.money = old;
                                        }
                                        return; }
                            }
                        }
                    }

                case "colors":
                case "color":
                case "colours":
                case "colour":
                    if (!par2.StartsWith("&") || !par2.StartsWith("%"))
                    {
                        switch (par2)
                        {
                        case "black":
                            par2 = "&0";
                            break;

                        case "navy":
                            par2 = "&1";
                            break;

                        case "green":
                            par2 = "&2";
                            break;

                        case "teal":
                            par2 = "&3";
                            break;

                        case "maroon":
                            par2 = "&4";
                            break;

                        case "purple":
                            par2 = "&5";
                            break;

                        case "gold":
                            par2 = "&6";
                            break;

                        case "silver":
                            par2 = "&7";
                            break;

                        case "gray":
                            par2 = "&8";
                            break;

                        case "blue":
                            par2 = "&9";
                            break;

                        case "lime":
                            par2 = "&a";
                            break;

                        case "aqua":
                            par2 = "&b";
                            break;

                        case "red":
                            par2 = "&c";
                            break;

                        case "pink":
                            par2 = "&d";
                            break;

                        case "yellow":
                            par2 = "&e";
                            break;

                        case "white":
                            par2 = "&f";
                            break;

                        default:
                            Player.SendMessage(p, "That wasn't a color");
                            return;
                        }
                    }
                    if (par2 == p.color)
                    {
                        Player.SendMessage(p, "You already have that color"); return;
                    }
                    if (p.EnoughMoney(Economy.Settings.ColorPrice) == false)
                    {
                        Player.SendMessage(p, "You don't have enough " + Server.moneys + " to buy a color"); return;
                    }
                    else
                    {
                        Command.all.Find("color").Use(null, p.name + " " + c.Name(par2)); p.money = p.money - Economy.Settings.ColorPrice; Player.SendMessage(p, "Changed color"); Player.SendMessage(p, "Your balance is now " + p.money.ToString() + " " + Server.moneys); return;
                    }

                case "titles":
                case "title":
                    if (par2 == p.title)
                    {
                        Player.SendMessage(p, "You already have that title"); return;
                    }
                    if (p.EnoughMoney(Economy.Settings.TitlePrice) == false)
                    {
                        Player.SendMessage(p, "You don't have enough " + Server.moneys + " to buy a title"); return;
                    }
                    if (par2.Length > 17)
                    {
                        Player.SendMessage(p, "Title cannot be longer than 17 characters."); return;
                    }
                    Command.all.Find("title").Use(null, p.name + " " + par2); p.money = p.money - Economy.Settings.TitlePrice; Player.SendMessage(p, "Changed title"); Player.SendMessage(p, "Your balance is now " + p.money + " " + Server.moneys); return;

                case "ranks":
                case "rank":
                    if (p.group.Permission == Economy.Settings.MaxRank || p.group.Permission >= Economy.Settings.MaxRank)
                    {
                        Player.SendMessage(p, "You are past the max buyable rank"); return;
                    }
                    if (p.EnoughMoney(Economy.NextRank(p).price) == false)
                    {
                        Player.SendMessage(p, "You don't have enough " + Server.moneys + " to buy the next rank"); return;
                    }
                    else
                    {
                        Command.all.Find("promote").Use(null, p.name); p.money = p.money - Economy.FindRank(p.group.name).price; Player.SendMessage(p, "You bought the rank " + p.group.name); Player.SendMessage(p, "Your balance is now " + p.money.ToString() + " " + Server.moneys); return;
                    }

                default:
                    Player.SendMessage(p, "That wasn't a valid command addition");
                    return;
                }

            case "stats":
            case "balance":
            case "amount":
                if (par1 != null)
                {
                    Player who = Player.Find(par1);
                    if (who == null)
                    {
                        Player.SendMessage(p, "That player doesn't exist"); return;
                    }
                    else
                    {
                        Player.SendMessage(p, "Stats for: " + who.color + who.name);
                        Player.SendMessage(p, "============================================================");
                        Player.SendMessage(p, Server.moneys + ": &b$" + who.money);
                        return;
                    }
                }
                else
                {
                    Player.SendMessage(p, "Stats for: " + p.color + p.name);
                    Player.SendMessage(p, "============================================================");
                    Player.SendMessage(p, Server.moneys + ": &b$" + p.money);
                    return;
                }

            case "info":
            case "about":
                if (Economy.Settings.Enabled == true)
                {
                    switch (par1)
                    {
                    case "map":
                    case "level":
                    case "maps":
                    case "levels":
                        if (Economy.Settings.Levels == false)
                        {
                            Player.SendMessage(p, "Maps are not enabled for the economy system"); return;
                        }
                        Player.SendMessage(p, "Maps avaliable:");
                        foreach (Economy.Settings.Level lvl in Economy.Settings.LevelsList)
                        {
                            Player.SendMessage(p, lvl.name + " (" + lvl.x + "," + lvl.y + "," + lvl.z + ") " + lvl.type + ":" + lvl.price);
                        }
                        return;

                    case "title":
                    case "titles":
                        if (Economy.Settings.Titles == false)
                        {
                            Player.SendMessage(p, "Titles are not enabled for the economy system"); return;
                        }
                        Player.SendMessage(p, "Titles cost " + Economy.Settings.TitlePrice.ToString() + " each");
                        return;

                    case "colors":
                    case "color":
                    case "colours":
                    case "colour":
                        if (Economy.Settings.Colors == false)
                        {
                            Player.SendMessage(p, "Colors are not enabled for the economy system"); return;
                        }
                        Player.SendMessage(p, "Colors cost " + Economy.Settings.ColorPrice.ToString() + " each");
                        return;

                    case "ranks":
                    case "rank":
                        if (Economy.Settings.Ranks == false)
                        {
                            Player.SendMessage(p, "Ranks are not enabled for the economy system"); return;
                        }
                        Player.SendMessage(p, "The maximum buyable rank is " + Economy.Settings.MaxRank.ToString());
                        Player.SendMessage(p, "Ranks cost:");
                        foreach (Economy.Settings.Rank rnk in Economy.Settings.RanksList)
                        {
                            Player.SendMessage(p, rnk.group.name + ": " + rnk.price);
                        }
                        return;

                    default:
                        Player.SendMessage(p, "That wasn't a valid command addition");
                        return;
                    }
                }
                else
                {
                    Player.SendMessage(p, "The economy system is currently disabled"); return;
                }

            case "help":
                switch (par1)
                {
                case "":
                    Help(p);
                    return;

                case "buy":
                    Player.SendMessage(p, "Use '/eco buy' to buy things");
                    Player.SendMessage(p, "To buy a map do '/eco buy map [presetname] [custommapname]'");
                    Player.SendMessage(p, "You can view presets with /eco info maps, [custommapname] is the name for your map");
                    Player.SendMessage(p, "To buy a rank just type '/eco buy rank'");
                    Player.SendMessage(p, "To buy a color or title just type '/eco buy [color/title] <color/title>'");
                    return;

                case "stats":
                case "balance":
                case "amount":
                    Player.SendMessage(p, "To find out your own balance of " + Server.moneys + " just do '/eco stats'");
                    Player.SendMessage(p, "To find out someone else's balance of " + Server.moneys + " just do '/eco stats [playername]'");
                    return;

                case "info":
                case "about":
                    Player.SendMessage(p, "To find out info about buying anything just do '/eco info [map/title/color/rank]'");
                    return;

                case "setup":
                    if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "Use '/eco setup' to setup the economy system");
                        Player.SendMessage(p, "Use '/eco setup [title/color] [price]' to setup the prices");
                        Player.SendMessage(p, "Use '/eco setup [title/color/rank/map] [enable/disable]' to enable/disable that feature");
                        Player.SendMessage(p, "Use '/eco setup map new [name] [x] [y] [z] [type] [price]' to setup a map preset");
                        Player.SendMessage(p, "Use '/eco setup map delete [name]' to delete a map");
                        Player.SendMessage(p, "Use '/eco setup map edit [name] [name/x/y/z/type/price] [value]' to edit a map preset");
                        Player.SendMessage(p, "Use '/eco setup rank price [rank] [price]' to set the price for that rank");
                        Player.SendMessage(p, "Use '/eco setup rank maxrank [rank]' to set the max buyable rank");
                        return;
                    }
                    else
                    {
                        Player.SendMessage(p, "You aren't a high enough rank for that"); return;
                    }

                default:
                    Player.SendMessage(p, "That wasn't a valid command addition, Sending you to help");
                    Help(p);
                    return;
                }

            default:
                Player.SendMessage(p, "That wasn't a valid command addition, Sending you to help");
                Help(p);
                return;
            }
        }