public void manageAirVectors() { for (int i = 0; i < tasks.size(); i++) { if (((FireComboStream) tasks.get(i)).isCancelled()) { tasks.remove(i); i--; } } if (tasks.size() == 0) { remove(); return; } for (int i = 0; i < tasks.size(); i++) { FireComboStream fstream = (FireComboStream) tasks.get(i); Location loc = fstream.getLocation(); if (GeneralMethods.isRegionProtectedFromBuild(this, loc)) { fstream.remove(); return; } if (!isTransparent(loc.getBlock())) { if (!isTransparent(loc.clone().add(0, 0.2, 0).getBlock())) { fstream.remove(); return; } } if (i % 3 == 0) { for (Entity entity : GeneralMethods.getEntitiesAroundPoint(loc, 2.5)) { if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation())) { remove(); return; } if (!entity.equals(player) && !affectedEntities.contains(entity)) { affectedEntities.add(entity); if (knockback != 0) { Vector force = fstream.getDirection(); entity.setVelocity(force.multiply(knockback)); } if (damage != 0) { if (entity instanceof LivingEntity) { if (fstream.getAbility().equalsIgnoreCase("AirSweep")) { DamageHandler.damageEntity(entity, damage, this); } else { DamageHandler.damageEntity(entity, damage, this); } } } } } if (GeneralMethods.blockAbilities(player, FireCombo.getBlockableAbilities(), loc, 1)) { fstream.remove(); } else AirAbility.removeAirSpouts(loc, player); WaterAbility.removeWaterSpouts(loc, player); EarthAbility.removeSandSpouts(loc, player); } } }
public static boolean removeAroundPoint( Player player, String ability, Location loc, double radius) { boolean removed = false; for (AirCombo combo : getAbilities(AirCombo.class)) { if (combo.getPlayer().equals(player)) { continue; } else if (ability.equalsIgnoreCase("Twister") && combo.abilityName.equalsIgnoreCase("Twister")) { if (combo.currentLoc != null && combo.currentLoc.getWorld().equals(loc.getWorld()) && Math.abs(combo.currentLoc.distance(loc)) <= radius) { combo.remove(); removed = true; } } else if (ability.equalsIgnoreCase("AirStream") && combo.abilityName.equalsIgnoreCase("AirStream")) { if (combo.currentLoc != null && combo.currentLoc.getWorld().equals(loc.getWorld()) && Math.abs(combo.currentLoc.distance(loc)) <= radius) { combo.remove(); removed = true; } } else if (ability.equalsIgnoreCase("AirSweep") && combo.abilityName.equalsIgnoreCase("AirSweep")) { for (int j = 0; j < combo.tasks.size(); j++) { FireComboStream fs = (FireComboStream) combo.tasks.get(j); if (fs.getLocation() != null && fs.getLocation().getWorld().equals(loc.getWorld()) && Math.abs(fs.getLocation().distance(loc)) <= radius) { fs.remove(); removed = true; } } } } return removed; }