Esempio n. 1
0
  private void progress() {
    if (!hasEmptyWaterBottle()) {
      remove();
      return;
    }

    if (player.isDead() || !player.isOnline()) {
      remove();
      return;
    }

    if (player.getWorld() != location.getWorld()) {
      remove();
      return;
    }

    if (System.currentTimeMillis() < time + interval) return;

    time = System.currentTimeMillis();

    Vector direction = Methods.getDirection(location, player.getEyeLocation()).normalize();
    location = location.clone().add(direction);

    if (location == null || block == null) {
      remove();
      return;
    }

    if (location.getBlock().equals(block.getLocation().getBlock())) return;

    if (Methods.isRegionProtectedFromBuild(player, "WaterManipulation", location)) {
      remove();
      return;
    }

    if (location.distance(player.getEyeLocation())
        > Methods.waterbendingNightAugment(range, player.getWorld())) {
      remove();
      return;
    }

    if (location.distance(player.getEyeLocation()) <= 1.5) {
      fillBottle();
      return;
    }

    Block newblock = location.getBlock();
    if (Methods.isTransparentToEarthbending(player, newblock) && !newblock.isLiquid()) {
      block.revertBlock();
      block = new TempBlock(newblock, Material.WATER, full);
    } else {
      remove();
      return;
    }
  }
Esempio n. 2
0
 private void remove() {
   if (block != null) {
     block.revertBlock();
     block = null;
   }
   instances.remove(player);
 }