Exemplo n.º 1
0
  public void Execute(Sign signBlock, InputState currentInputs, InputState previousInputs) {
    if (currentInputs.isInputOneHigh() && previousInputs.isInputOneLow()) {

      if (this.getData(signBlock) == null) {
        return;
      }

      this.outputData(this.getData(signBlock), signBlock, 2);
    }
  }
Exemplo n.º 2
0
  public void Execute(Sign signBlock, InputState currentInputs, InputState previousInputs) {

    if (currentInputs.isInputOneHigh() && previousInputs.isInputOneLow()) {
      BaseData data = this.getData(signBlock);

      if (data == null) {
        return;
      }

      if (data.getType() == DataTypes.NUMBER) {
        int rand = new Random().nextInt(((NumberData) data).getInt());
        outputData(new NumberData(rand), signBlock, 2);
      }
    }
  }
Exemplo n.º 3
0
  public void Execute(Sign signBlock, InputState currentInputs, InputState previousInputs) {
    boolean input1High = currentInputs.isInputOneHigh();
    boolean input2High = currentInputs.isInputTwoHigh();
    MC2111.SchedulerClass sched;
    Iterator newSched;
    if (!input1High && !input2High) {
      newSched = this.TaskList.values().iterator();

      while (newSched.hasNext()) {
        sched = (MC2111.SchedulerClass) newSched.next();
        if (sched.equalsLoc(signBlock.getBlock().getLocation())) {
          Bukkit.getServer().getScheduler().cancelTask(sched.TaskID);
          this.TaskList.remove(signBlock.getBlock().getLocation().toString());
          break;
        }
      }

      if (!Parser.isInteger(signBlock.getLine(2))) {
        return;
      }

      int sched1 = Math.abs(Parser.getInteger(signBlock.getLine(2), 1));
      MC2111.SchedulerClass newSched1 =
          new MC2111.SchedulerClass(this, signBlock.getBlock().getLocation());
      newSched1.TaskID =
          Bukkit.getServer()
              .getScheduler()
              .scheduleSyncDelayedTask(
                  FalseBookICCore.getInstance(), newSched1, (long) (20 * sched1));
      this.TaskList.put(signBlock.getBlock().getLocation().toString(), newSched1);
    } else if (input1High || input2High) {
      newSched = this.TaskList.values().iterator();

      while (newSched.hasNext()) {
        sched = (MC2111.SchedulerClass) newSched.next();
        if (sched.equalsLoc(signBlock.getBlock().getLocation())) {
          Bukkit.getServer().getScheduler().cancelTask(sched.TaskID);
          this.TaskList.remove(signBlock.getBlock().getLocation().toString());
          break;
        }
      }

      this.switchLever(Lever.BACK, signBlock, false);
    }
  }
Exemplo n.º 4
0
 public void Execute(Sign signBlock, InputState currentInputs, InputState previousInputs) {
   boolean inputA = currentInputs.isInputOneHigh();
   boolean inputB = currentInputs.isInputTwoHigh();
   boolean inputC = currentInputs.isInputThreeHigh();
   if (inputA && !inputB && !inputC) {
     this.switchLever(Lever.BACK, signBlock, true, 3);
     this.switchLever(Lever.LEFT, signBlock, false, 2);
     this.switchLever(Lever.RIGHT, signBlock, false, 2);
   } else if (!inputA && inputB && !inputC) {
     this.switchLever(Lever.BACK, signBlock, false, 3);
     this.switchLever(Lever.LEFT, signBlock, true, 2);
     this.switchLever(Lever.RIGHT, signBlock, false, 2);
   } else if (!inputA && !inputB && inputC) {
     this.switchLever(Lever.BACK, signBlock, false, 3);
     this.switchLever(Lever.LEFT, signBlock, false, 2);
     this.switchLever(Lever.RIGHT, signBlock, true, 2);
   } else {
     this.switchLever(Lever.BACK, signBlock, false, 3);
     this.switchLever(Lever.LEFT, signBlock, false, 2);
     this.switchLever(Lever.RIGHT, signBlock, false, 2);
   }
 }