Esempio n. 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();
    }
  }
Esempio n. 2
0
  public void signRemoveInput(Sign sign, Map map, int flux) {

    ArrayList<Integer> newInputs = new ArrayList<Integer>();

    Iterator<Integer> it = sign.getInputsSignals().iterator();

    while (it.hasNext()) {
      int i = it.next();
      if (i == flux) continue;
      else newInputs.add(i);
    }

    sign.setInputsSignals(newInputs);

    this.editor.buildSign(sign, map);

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

    this.signInfo(sign, map);
  }
Esempio n. 3
0
  public void signAddOutput(Sign sign, Map map, int flux, boolean fluxValue) {
    sign.getOutputSignals().add(new OutputSignal(flux, fluxValue));
    this.editor.buildSign(sign, map);

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

    this.signInfo(sign, map);
  }
Esempio n. 4
0
  public void signAddInput(Sign sign, Map map, int flux) {
    sign.getInputsSignals().add(flux);
    this.editor.buildSign(sign, map);

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

    this.signInfo(sign, map);
  }
Esempio n. 5
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");
  }
Esempio n. 6
0
  public void signRemoveOutput(Sign sign, Map map, int flux, boolean fluxValue) {
    ArrayList<OutputSignal> newOutputs = new ArrayList<OutputSignal>();

    for (OutputSignal os : sign.getOutputSignals()) {
      if (os.getSignal() == flux && os.isOn() == fluxValue) continue;
      newOutputs.add(os);
    }

    sign.setOutputSignals(newOutputs);

    this.editor.buildSign(sign, map);

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

    this.signInfo(sign, map);
  }