Exemplo n.º 1
0
  @Override
  public void progress() {
    if (!bPlayer.canBendIgnoreBindsCooldowns(this)) {
      remove();
      return;
    }

    getFloor();
    if (floorblock == null) {
      remove();
      return;
    }

    Vector velocity = player.getEyeLocation().getDirection().clone();
    velocity.setY(0);
    velocity = velocity.clone().normalize().multiply(speed);

    if (System.currentTimeMillis() > startTime + interval) {
      if (player.getVelocity().length() < speed * .5) {
        remove();
        return;
      }
      spinScooter();
    }

    double distance = player.getLocation().getY() - (double) floorblock.getY();
    double dx = Math.abs(distance - 2.4);
    if (distance > 2.75) {
      velocity.setY(-.25 * dx * dx);
    } else if (distance < 2) {
      velocity.setY(.25 * dx * dx);
    } else {
      velocity.setY(0);
    }

    Location loc = player.getLocation();
    if (!WaterAbility.isWater(player.getLocation().add(0, 2, 0).getBlock())) {
      loc.setY((double) floorblock.getY() + 1.5);
    } else {
      return;
    }

    player.setSprinting(false);
    player.removePotionEffect(PotionEffectType.SPEED);
    player.setVelocity(velocity);
    if (random.nextInt(4) == 0) {
      playAirbendingSound(player.getLocation());
    }
  }