private void cancelPrevious() { LavaSurgeWall lavaWall = getAbility(player, LavaSurgeWall.class); if (lavaWall != null) { if (lavaWall.progressing) { lavaWall.removeLava(lavaWall.sourceBlock); } else { lavaWall.cancel(); } } }
@Override public void progress() { if (!bPlayer.canBendIgnoreCooldowns(this)) { if (!forming) { breakBlock(); } remove(); return; } if (System.currentTimeMillis() - time >= interval) { time = System.currentTimeMillis(); if (progressing && !player.isSneaking()) { remove(); return; } if (!progressing) { sourceBlock.getWorld().playEffect(location, Effect.SMOKE, 4, (int) range); return; } if (forming) { ArrayList<Block> blocks = new ArrayList<Block>(); Location loc = GeneralMethods.getTargetedLocation(player, (int) range, 8, 9, 79); location = loc.clone(); Vector dir = player.getEyeLocation().getDirection(); Vector vec; Block block; for (double i = 0; i <= radius; i += 0.5) { for (double angle = 0; angle < 360; angle += 10) { vec = GeneralMethods.getOrthogonalVector(dir.clone(), angle, i); block = loc.clone().add(vec).getBlock(); if (GeneralMethods.isRegionProtectedFromBuild( player, "LavaSurge", block.getLocation())) { continue; } if (WALL_BLOCKS.containsKey(block)) { blocks.add(block); } else if (!blocks.contains(block) && (block.getType() == Material.AIR || block.getType() == Material.FIRE || isLavabendable(block))) { WALL_BLOCKS.put(block, player); addWallBlock(block); blocks.add(block); FireBlast.removeFireBlastsAroundPoint(block.getLocation(), 2); } } } for (Block blocki : WALL_BLOCKS.keySet()) { if (WALL_BLOCKS.get(blocki) == player && !blocks.contains(blocki)) { finalRemoveLava(blocki); } } return; } if (sourceBlock.getLocation().distanceSquared(firstDestination) < 0.5 * 0.5 && settingUp) { settingUp = false; } Vector direction; if (settingUp) { direction = firstDirection; } else { direction = targetDirection; } location = location.clone().add(direction); Block block = location.getBlock(); if (block.getLocation().equals(sourceBlock.getLocation())) { location = location.clone().add(direction); block = location.getBlock(); } if (block.getType() != Material.AIR) { breakBlock(); return; } else if (!progressing) { breakBlock(); return; } addLava(block); removeLava(sourceBlock); sourceBlock = block; if (location.distanceSquared(targetDestination) < 1) { removeLava(sourceBlock); forming = true; } return; } }