Exemple #1
0
        public void Execute(Player p, string[] args)
        {
            if (p.Rank < CmdsPermissions.get(2))
            {
                p.SendMessage("You don't have the permission to use this command."); return;
            }

            if (args.Length < 2)
            {
                help(p); return;
            }
            try
            {
                ushort ID;
                switch (args[1])
                {
                case "create":

                    ID = Helpers.IDConvert(ushort.Parse(args[4]));

                    RecipesRegistry.Create(args[2], args[3], ID, int.Parse(args[5]));
                    p.SendMessage("Craft " + args[2] + " created.");
                    break;

                case "delete":
                    RecipesRegistry.Remove(args[2]);
                    p.SendMessage("Craft " + args[2] + " deleted.");
                    break;

                case "add":

                    ID = Helpers.IDConvert(ushort.Parse(args[3]));

                    RecipesRegistry.AddIngredient(args[2], ID, int.Parse(args[4]));
                    p.SendMessage("Ingredient " + Block.GetName(p, ID) + " x" + args[4] + " added.");
                    break;

                case "remove":

                    ID = Helpers.IDConvert(ushort.Parse(args[3]));

                    RecipesRegistry.RemoveIngredient(args[2], ID);
                    p.SendMessage("Ingredient " + Block.GetName(p, ID) + " removed.");
                    break;

                default:
                    help(p);
                    break;
                }
            }
            catch { help(p); }
        }
Exemple #2
0
        public void Execute(Player p, string[] args)
        {
            if (p.Rank < CmdSetPermRank)
            {
                p.SendMessage("You don't have the permission to use this command."); return;
            }
            if (args.Length < 2)
            {
                help(p); return;
            }
            try
            {
                switch (args[1])
                {
                case "blocks":
                    CmdsPermissions.set(0, int.Parse(args[2]));
                    break;

                case "crafting":
                    CmdsPermissions.set(2, int.Parse(args[2]));
                    break;

                case "tools":
                    CmdsPermissions.set(4, int.Parse(args[2]));
                    break;

                case "maps":
                    CmdsPermissions.set(3, int.Parse(args[2]));
                    break;

                case "cmds":
                    CmdsPermissions.set(1, int.Parse(args[2]));
                    break;

                case "actions":
                    CmdsPermissions.set(5, int.Parse(args[2]));
                    break;

                default:
                    help(p);
                    return;
                }
                p.SendMessage("Permission set to " + args[2] + " for this command.");
            }
            catch {
                help(p);
            }
        }
        public void Execute(Player p, string[] args)
        {
            if (p.Rank < CmdsPermissions.get(1))
            {
                p.SendMessage("You don't have the permission to use this command."); return;
            }
            if (args.Length < 2)
            {
                help(p); return;
            }
            string cmd = "";

            switch (args[1])
            {
            case "add":

                cmd = args[2];
                if (args.Length > 3)
                {
                    cmd += " " + args[3];
                }
                CmdsWhitelistRegistry.Add(cmd);
                p.SendMessage("Added " + cmd + ".");
                break;

            case "remove":
                cmd = args[2];
                if (args.Length > 3)
                {
                    cmd += " " + args[3];
                }
                CmdsWhitelistRegistry.Remove(cmd);
                p.SendMessage("Removed " + cmd + ".");
                break;

            case "list":
                Helpers.SendTextBlockToPlayer(p, "%eCommands Whitelisted:\n" + CmdsWhitelistRegistry.getListString());
                break;

            default:
                help(p);
                break;
            }
        }
Exemple #4
0
        public void Execute(Player p, string[] args)
        {
            if (p.Rank < CmdsPermissions.get(3))
            {
                p.SendMessage("You don't have the permission to use this command."); return;
            }
            if (args.Length < 2)
            {
                help(p); return;
            }
            switch (args[1])
            {
            case "add":

                Player[] online = PlayerInfo.Online.Items;
                foreach (Player pl in online)
                {
                    if (pl.level.name == args[2])
                    {
                        _playersList.PlayerMap[pl] = new SurvivalPlayer(pl, _survivalMaps);
                    }
                }

                _survivalMaps.Maps.AddMap(args[2]);
                p.SendMessage("Added " + args[2] + ".");
                break;

            case "remove":
                _survivalMaps.Maps.RemoveMap(args[2]);
                p.SendMessage("Removed " + args[2] + ".");
                break;

            case "list":
                Helpers.SendTextBlockToPlayer(p, "%eSurvival Maps List:\n" + _survivalMaps.Maps.getListString());
                break;

            default:
                help(p);
                break;
            }
        }
Exemple #5
0
        public void Execute(Player p, string[] args)
        {
            if (p.Rank < CmdsPermissions.get(0))
            {
                p.SendMessage("You don't have the permission to use this command."); return;
            }

            if (args.Length < 2)
            {
                help(p); return;
            }

            ushort id = 0;

            if (args.Length > 2)
            {
                id = ushort.Parse(args[2]);
            }
            try
            {
                switch (args[1])
                {
                case "add":
                    if (args.Length < 4)
                    {
                        help(p); return;
                    }

                    ushort givenID       = id;
                    int    givenQuantity = 1;
                    string category      = "";

                    if (args.Length > 4)
                    {
                        givenID = ushort.TryParse(args[4], out givenID) ? ushort.Parse(args[4]) : id;
                    }

                    if (args.Length > 5)
                    {
                        givenQuantity = int.TryParse(args[5], out givenQuantity) ? int.Parse(args[5]) : 1;
                    }

                    if (args.Length > 6)
                    {
                        category = args[6];
                    }

                    givenID = Helpers.IDConvert(givenID);
                    id      = Helpers.IDConvert(id);

                    BlocksRegistry.Add(id, int.Parse(args[3]), givenID, givenQuantity, category);

                    Helpers.SendTextBlockToPlayer(p, "Set hardness of " + id + " to " + int.Parse(args[3]) + ".\n" +
                                                  "Set given ID of " + id + " to " + givenID + ".\n" +
                                                  "Set given Quantity of " + id + " to " + givenQuantity + ".\n" +
                                                  "Set Category of " + id + " to " + category + ".");

                    break;

                case "remove":
                    id = Helpers.IDConvert(id);
                    BlocksRegistry.Remove(id);
                    p.SendMessage("Removed the settings for " + id + ".");
                    break;

                case "list":
                    Helpers.SendTextBlockToPlayer(p, BlocksRegistry.getBlocksList(p));
                    break;

                default:
                    help(p);
                    break;
                }
            }
            catch { help(p); }
        }
Exemple #6
0
        public void Execute(Player p, string[] args)
        {
            if (p.Rank < CmdsPermissions.get(5))
            {
                p.SendMessage("You don't have the permission to use this command."); return;
            }
            try
            {
                ushort ID = 0;
                if (args.Length > 2)
                {
                    ID = Helpers.IDConvert(ushort.Parse(args[2]));
                }
                switch (args[1])
                {
                case "create":
                    ActionsBlocks.Init(ID);
                    break;

                case "remove":
                    ActionsBlocks.Remove(ID);
                    break;

                case "addtrigger":
                    ActionsBlocks.AddTrigger(ID, byte.Parse(args[3]));
                    break;

                case "removetrigger":
                    ActionsBlocks.RemoveTrigger(ID, int.Parse(args[3]));
                    break;

                case "removeaction":
                    ActionsBlocks.RemoveAction(ID, int.Parse(args[3]), int.Parse(args[4]));
                    break;

                case "addaction":

                    string strArg = "";
                    for (int i = 5; i < args.Length; i++)
                    {
                        strArg += args[i] + " ";
                    }

                    ActionsBlocks.AddAction(ID, int.Parse(args[3]), byte.Parse(args[4]), strArg);
                    break;

                case "list":
                    Helpers.SendTextBlockToPlayer(p, ActionsBlocks.getList(p));
                    break;

                case "actionslist":
                    Helpers.SendTextBlockToPlayer(p, ActionsBlocks.getActionsList(p, ID));
                    break;

                case "door":

                    ushort[] tempD = new ushort[8];
                    int      iincr = 0;
                    for (int i = 2; i <= 9; i++)
                    {
                        tempD[iincr++] = Helpers.IDConvert(ushort.Parse(args[i]));
                    }

                    ActionBlocks.Door.Builder(tempD);
                    break;

                default:
                    help(p);
                    break;
                }
            } catch { help(p); }
        }
Exemple #7
0
        public void Execute(Player p, string[] args)
        {
            if (p.Rank < CmdsPermissions.get(4))
            {
                p.SendMessage("You don't have the permission to use this command."); return;
            }

            if (args.Length < 2)
            {
                help(p); return;
            }
            try
            {
                ushort ID;
                switch (args[1])
                {
                case "create":

                    ID = Helpers.IDConvert(ushort.Parse(args[2]));

                    ToolsRegistry.Create(ID, int.Parse(args[3]), float.Parse(args[4], CultureInfo.InvariantCulture), int.Parse(args[5]));
                    break;

                case "delete":

                    ID = Helpers.IDConvert(ushort.Parse(args[2]));

                    ToolsRegistry.Remove(ID);
                    break;

                case "categories":

                    ID = Helpers.IDConvert(ushort.Parse(args[3]));

                    switch (args[2])
                    {
                    case "add":
                        ToolsRegistry.AddCategory(ID, args[4]);
                        break;

                    case "remove":
                        ToolsRegistry.RemoveCategory(ID, args[4]);
                        break;

                    default:
                        help(p);
                        break;
                    }
                    break;

                case "list":
                    Helpers.SendTextBlockToPlayer(p, ToolsRegistry.getToolsList(p));
                    break;

                default:
                    help(p);
                    break;
                }
            }
            catch {
                help(p);
            }
        }