Exemple #1
0
        public void Use(Player p, string[] args)
        {
            //if (p == null) stuff here, not sure if should add yet or not since Console cannot do commands at the moment.
            Point3 click = p.lastClick;
            if (args.Length == 0)
            {
                click = p.lastClick;
            }
            else if (args.Length == 3)
            {
                try
                {
                    for (int value = 0; value < 3; value++)
                    {
                        switch (args[value].ToLower())
                        {
                            case "x":
                                click.x = p.lastClick.x;
                                break;
                            case "z":
                                click.z = p.lastClick.z;
                                break;
                            case "y":
                                click.y = p.lastClick.y;
                                break;
                            default:
                                if (isValid(args[value], value, p))
                                {
                                    switch (value)
                                    {
                                        case 0:
                                            click.x = short.Parse(args[0]);
                                            break;
                                        case 1:
                                            click.z = short.Parse(args[1]);
                                            break;
                                        case 2:
                                            click.y = short.Parse(args[2]);
                                            break;
                                    }
                                }
                                else
                                {
                                    p.SendMessage("\"" + args[value] + "\" was not valid");
                                    return;
                                }
                                break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Server.Log(e);
                    return;
                }
            }
            else
            {
                p.SendMessage("Invalid arguments");
                return;
            }

            p.click((ushort)click.x, (ushort)click.z, (ushort)click.y, (byte)(Blocks.Types.stone));
            p.SendMessage("Click &b(" + click.x + ", " + click.z + ", " + click.y + ").");
        }