예제 #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.
            Vector3S click = p.LastClick;

            if (args.Length == 3) {
                try {
                    for (int value = 0; value < 3; value++) {
                        switch (args[value].ToLower()) {
                            case "x":
                            case "z":
                            case "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) {
                    Logger.LogError(e);
                    return;
                }
            }
            else {
                p.SendMessage("Invalid arguments");
                return;
            }

            p.Click((ushort)click.x, (ushort)click.z, (ushort)click.y, Block.BlockList.STONE);
            p.SendMessage("Click &b(" + click.x + ", " + click.z + ", " + click.y + ").");
        }
예제 #2
0
 void OnPlayerBlockChange_Normal(Player sender, BlockChangeEventArgs args) {
     args.Cancel();
     if (args.Current == 0 && args.Action == ActionType.Delete) args.Current = 20;
     sender.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
     if (sender.ExtraData["Cursor"] != null) {
         Vector3S cursor;
         if (sender.ExtraData["Cursor"].GetType() == typeof(Vector3S))
             cursor = (Vector3S)sender.ExtraData["Cursor"];
         else {
             cursor = new Vector3S();
             cursor.FromString((string)sender.ExtraData["Cursor"]);
         }
         if (args.Action == ActionType.Place) {
             sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y + 1), args.Holding);
         }
         else {
             sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y), args.Holding, false);
         }
     }
     sender.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
     Curse(sender);
 }