コード例 #1
0
  public void signOutput(Sign sign, Map map) {
    if (this.args.length <= 4) return;
    int flux;
    if (this.args[3].equalsIgnoreCase("n")) {
      flux = map.getNewSignal();
    } else if (!Utils.isInt(this.args[3])) return;
    else {
      flux = Integer.parseInt(this.args[3]);
    }
    boolean fluxValue;
    if (this.args[4].equalsIgnoreCase("true")
        || this.args[4].equalsIgnoreCase("t")
        || this.args[4].equalsIgnoreCase("on")) fluxValue = true;
    else if (this.args[4].equalsIgnoreCase("false")
        || this.args[4].equalsIgnoreCase("f")
        || this.args[4].equalsIgnoreCase("off")) fluxValue = false;
    else return;

    switch (this.args[2]) {
      case "add":
      case "a":
      case "+":
        this.signAddOutput(sign, map, flux, fluxValue);
        break;
      case "remove":
      case "r":
      case "-":
        this.signRemoveOutput(sign, map, flux, fluxValue);
        break;
    }
  }
コード例 #2
0
  public void go() {
    if (!(this.sender instanceof Player)) return;

    Player p = (Player) this.sender;
    Map map = this.editor.getMap(p.getWorld());
    if (map == null) return;
    if (this.args.length == 1) return;
    if (!Utils.isInt(this.args[1])) return;
    int n = Integer.parseInt(this.args[1]);
    if (n < 1) return;
    Sign sign = map.getSign(n);

    if (sign == null) {
      message("Sign not found, check /editor find...");
      return;
    }

    p.teleport(sign.getRealLocation(p.getWorld()));
    message("Teleported to sign #" + n);
  }
コード例 #3
0
  public void signInput(Sign sign, Map map) {
    if (this.args.length <= 3) return;

    int flux;
    if (this.args[3].equalsIgnoreCase("n")) {
      flux = map.getNewSignal();
    } else if (!Utils.isInt(this.args[3])) return;
    else {
      flux = Integer.parseInt(this.args[3]);
    }

    switch (this.args[2]) {
      case "add":
      case "a":
      case "+":
        this.signAddInput(sign, map, flux);
        break;
      case "remove":
      case "r":
      case "-":
        this.signRemoveInput(sign, map, flux);
        break;
    }
  }