private void ignite(Block block) { if (block.getType() != Material.AIR) { if (FireMethods.canFireGrief()) { if (WaterMethods.isPlant(block)) new Plantbending(block); } else if (block.getType() != Material.FIRE) { replacedBlocks.put(block.getLocation(), block.getState().getData()); } } block.setType(Material.FIRE); ignitedblocks.put(block, this.player); ignitedtimes.put(block, System.currentTimeMillis()); }
private void affectPeople(Location location, Vector direction) { WaterMethods.removeWaterSpouts(location, player); AirMethods.removeAirSpouts(location, player); final List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, affectingradius); final List<Entity> surroundingEntities = GeneralMethods.getEntitiesAroundPoint(location, 4); final Vector fDirection = direction; for (int i = 0; i < entities.size(); i++) { final Entity entity = entities.get(i); new BukkitRunnable() { public void run() { if (GeneralMethods.isRegionProtectedFromBuild(player, "AirSwipe", entity.getLocation())) return; if (entity.getEntityId() != player.getEntityId()) { if (entity instanceof Player) { if (Commands.invincible.contains(((Player) entity).getName())) return; } if (surroundingEntities.size() < MAX_AFFECTABLE_ENTITIES) { if (AvatarState.isAvatarState(player)) { GeneralMethods.setVelocity( entity, fDirection.multiply(AvatarState.getValue(pushfactor))); } else { GeneralMethods.setVelocity(entity, fDirection.multiply(pushfactor)); } } if (entity instanceof LivingEntity && !affectedentities.contains(entity)) { if (damage != 0) GeneralMethods.damageEntity(player, entity, damage, "AirSwipe"); affectedentities.add(entity); } if (entity instanceof Player) { new Flight((Player) entity, player); } AirMethods.breakBreathbendingHold(entity); if (elements.containsKey(fDirection)) { elements.remove(fDirection); } } } }.runTaskLater(ProjectKorra.plugin, i / MAX_AFFECTABLE_ENTITIES); } }
@SuppressWarnings("deprecation") private void advanceSwipe() { affectedentities.clear(); for (Vector direction : elements.keySet()) { Location location = elements.get(direction); if (direction != null && location != null) { location = location.clone().add(direction.clone().multiply(speedfactor)); elements.replace(direction, location); if (location.distance(origin) > range || GeneralMethods.isRegionProtectedFromBuild(player, "AirSwipe", location)) { elements.remove(direction); } else { AirMethods.removeAirSpouts(location, player); WaterMethods.removeWaterSpouts(location, player); double radius = FireBlast.AFFECTING_RADIUS; Player source = player; if (EarthBlast.annihilateBlasts(location, radius, source) || WaterManipulation.annihilateBlasts(location, radius, source) || FireBlast.annihilateBlasts(location, radius, source) || Combustion.removeAroundPoint(location, radius)) { elements.remove(direction); damage = 0; remove(); continue; } Block block = location.getBlock(); for (Block testblock : GeneralMethods.getBlocksAroundPoint(location, affectingradius)) { if (testblock.getType() == Material.FIRE) { testblock.setType(Material.AIR); } if (isBlockBreakable(testblock)) { GeneralMethods.breakBlock(testblock); } } if (block.getType() != Material.AIR) { if (isBlockBreakable(block)) { GeneralMethods.breakBlock(block); } else { elements.remove(direction); } if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA) { if (block.getData() == full) { block.setType(Material.OBSIDIAN); } else { block.setType(Material.COBBLESTONE); } } } else { AirMethods.playAirbendingParticles(location, 3, 0.2F, 0.2F, 0); if (GeneralMethods.rand.nextInt(4) == 0) { AirMethods.playAirbendingSound(location); } affectPeople(location, direction); } } // } else { // elements.remove(direction); } } if (elements.isEmpty()) { remove(); } }
private boolean progress() { if (player.isDead() || !player.isOnline() || !GeneralMethods.canBend(player.getName(), "EarthBlast")) { breakBlock(); return false; } if (System.currentTimeMillis() - time >= interval) { time = System.currentTimeMillis(); if (falling) { breakBlock(); return false; } if (!EarthMethods.isEarthbendable(player, sourceblock) && sourceblock.getType() != Material.COBBLESTONE) { instances.remove(id); return false; } if (!progressing && !falling) { if (GeneralMethods.getBoundAbility(player) == null) { unfocusBlock(); return false; } if (!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("EarthBlast")) { unfocusBlock(); return false; } if (sourceblock == null) { instances.remove(id); return false; } if (!player.getWorld().equals(sourceblock.getWorld())) { unfocusBlock(); return false; } if (sourceblock.getLocation().distance(player.getLocation()) > preparerange) { unfocusBlock(); return false; } } if (falling) { breakBlock(); } else { if (!progressing) { return false; } if (sourceblock.getY() == firstdestination.getBlockY()) { settingup = false; } Vector direction; if (settingup) { direction = GeneralMethods.getDirection(location, firstdestination).normalize(); } else { direction = GeneralMethods.getDirection(location, destination).normalize(); } location = location.clone().add(direction); WaterMethods.removeWaterSpouts(location, player); AirMethods.removeAirSpouts(location, player); Block block = location.getBlock(); if (block.getLocation().equals(sourceblock.getLocation())) { location = location.clone().add(direction); block = location.getBlock(); } if (EarthMethods.isTransparentToEarthbending(player, block) && !block.isLiquid()) { GeneralMethods.breakBlock(block); } else if (!settingup) { breakBlock(); return false; } else { location = location.clone().subtract(direction); direction = GeneralMethods.getDirection(location, destination).normalize(); location = location.clone().add(direction); WaterMethods.removeWaterSpouts(location, player); AirMethods.removeAirSpouts(location, player); double radius = FireBlast.AFFECTING_RADIUS; Player source = player; if (EarthBlast.annihilateBlasts(location, radius, source) || WaterManipulation.annihilateBlasts(location, radius, source) || FireBlast.annihilateBlasts(location, radius, source)) { breakBlock(); return false; } Combustion.removeAroundPoint(location, radius); Block block2 = location.getBlock(); if (block2.getLocation().equals(sourceblock.getLocation())) { location = location.clone().add(direction); block2 = location.getBlock(); } if (EarthMethods.isTransparentToEarthbending(player, block) && !block.isLiquid()) { GeneralMethods.breakBlock(block); } else { breakBlock(); return false; } } for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, FireBlast.AFFECTING_RADIUS)) { if (GeneralMethods.isRegionProtectedFromBuild( player, "EarthBlast", entity.getLocation())) { continue; } if (entity instanceof LivingEntity && (entity.getEntityId() != player.getEntityId() || hitself)) { AirMethods.breakBreathbendingHold(entity); Location location = player.getEyeLocation(); Vector vector = location.getDirection(); entity.setVelocity(vector.normalize().multiply(pushfactor)); double damage = this.damage; if (EarthMethods.isMetal(sourceblock) && EarthMethods.canMetalbend(player)) { damage = EarthMethods.getMetalAugment(this.damage); } GeneralMethods.damageEntity(player, entity, damage); progressing = false; } } if (!progressing) { breakBlock(); return false; } if (revert) { // Methods.addTempEarthBlock(sourceblock, block); if (sourceblock.getType() == Material.RED_SANDSTONE) { sourceblock.setType(sourcetype); if (sourcetype == Material.SAND) { sourceblock.setData((byte) 0x1); } } else { sourceblock.setType(sourcetype); } EarthMethods.moveEarthBlock(sourceblock, block); if (block.getType() == Material.SAND) { block.setType(Material.SANDSTONE); } if (block.getType() == Material.GRAVEL) { block.setType(Material.STONE); } } else { block.setType(sourceblock.getType()); sourceblock.setType(Material.AIR); } sourceblock = block; if (location.distance(destination) < 1) { if (sourcetype == Material.SAND || sourcetype == Material.GRAVEL) { progressing = false; if (sourceblock.getType() == Material.RED_SANDSTONE) { sourcetype = Material.SAND; sourceblock.setType(sourcetype); sourceblock.setData((byte) 0x1); } else { sourceblock.setType(sourcetype); } } falling = true; progressing = false; } return true; } } return false; }