Example #1
0
  public void signSet(Sign sign, Map map) {
    if (this.args.length < 4) return;

    String key = this.args[2];
    String value = Utils.multiArgs(this.args, 3);

    if (!sign.getDefaultOptions().containsKey(key)
        && !sign.getObjectType().equals(ObjectType.CUSTOM)) {
      message("Option <" + key + "> is not defined for object " + sign.getTypeName());
      return;
    }

    // Option value reset
    if (value.equals("default") && sign.getOptions().containsKey(key)) {
      sign.getOptions().remove(key);
      message(
          "Option <"
              + key
              + "> has now it default value "
              + ChatColor.WHITE
              + sign.getDefaultOptions().get(key).getValue());
    } else {
      sign.getOptions().put(key, value);
      message("Option <" + key + "> has now value " + ChatColor.WHITE + value);
    }

    try {
      map.writeSigns();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Example #2
0
  public void signInfo(Sign sign, Map map) {
    int number = map.getSignNumber(sign);
    message("*******************************");
    message(ChatColor.WHITE + "" + ChatColor.BOLD + sign.getTypeName() + " #" + number);
    message("*******************************");

    message("Inputs : " + this.editor.displayInputs(sign));
    message("Outputs ON : " + this.editor.displayOutputs(sign, true));
    message("Outputs OFF : " + this.editor.displayOutputs(sign, false));

    message(ChatColor.YELLOW + "" + ChatColor.BOLD + "Options :");

    for (String key : sign.getOptions().keySet()) {
      message(ChatColor.WHITE + key + " : " + ChatColor.GRAY + sign.getOptions().get(key));
    }

    for (String key : sign.getDefaultOptions().keySet()) {
      if (sign.getOptions().containsKey(key)) continue;
      message(
          ChatColor.GRAY
              + ""
              + ChatColor.ITALIC
              + key
              + " : "
              + ChatColor.GRAY
              + sign.getDefaultOptions().get(key).getValue()
              + " ("
              + sign.getDefaultOptions().get(key).getOptionType().name().toLowerCase()
              + ")");
    }
  }
Example #3
0
  public void signPaste(Sign sign, Map map) {
    if (!this.editor.getClipBoards().containsKey((Player) sender)) {
      message("Use /editor sign copy first !");
      return;
    }

    Sign source = this.editor.getClipBoards().get((Player) sender);
    sign.copyData(source);
    this.editor.buildSign(sign, map);

    try {
      map.writeSigns();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    message(ChatColor.YELLOW + "Sign " + sign.getTypeName() + " pasted");
  }
Example #4
0
  public void find() {
    if (!(this.sender instanceof Player)) return;

    Player p = (Player) this.sender;
    Map map = this.editor.getMap(p.getWorld());
    if (map == null) return;

    ArrayList<Sign> results;

    if (this.args.length == 1) {
      message("Searching for signs...");
      results = map.getSigns();
    } else {
      results = new ArrayList<Sign>();
      for (Sign s : map.getSigns()) {
        if (s.getObjectName().contains(this.args[1])) {
          results.add(s);
        }
      }
    }

    message(results.size() + " signs found :");

    for (Sign sign : results) {

      int n = map.getSignNumber(sign);
      int distance = (int) Math.round(sign.getRealLocation(p.getWorld()).distance(p.getLocation()));
      message(
          "#"
              + n
              + " "
              + ChatColor.WHITE
              + sign.getTypeName()
              + ChatColor.GRAY
              + " ("
              + distance
              + "m)");
    }
  }
Example #5
0
 public void signCopy(Sign sign, Map map) {
   this.editor.getClipBoards().put((Player) sender, sign);
   message(ChatColor.YELLOW + "Sign " + sign.getTypeName() + " copied in clipboard");
 }