diff --git a/src/com/projectkorra/projectkorra/airbending/AirBlast.java b/src/com/projectkorra/projectkorra/airbending/AirBlast.java index e2398346..7a75c6b4 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirBlast.java +++ b/src/com/projectkorra/projectkorra/airbending/AirBlast.java @@ -425,10 +425,8 @@ public class AirBlast extends AirAbility { } for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - continue; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } this.affect(entity); } diff --git a/src/com/projectkorra/projectkorra/airbending/AirSuction.java b/src/com/projectkorra/projectkorra/airbending/AirSuction.java index 194a7a71..cb5d0a33 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirSuction.java +++ b/src/com/projectkorra/projectkorra/airbending/AirSuction.java @@ -192,10 +192,8 @@ public class AirSuction extends AirAbility { } for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - continue; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } final Vector velocity = entity.getVelocity(); final double max = this.speed; diff --git a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java index d9855b27..95544e88 100644 --- a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java +++ b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java @@ -164,10 +164,8 @@ public class AirStream extends AirAbility implements ComboAbility { } for (final Entity entity : this.affectedEntities) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - continue; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } final Vector force = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc); entity.setVelocity(force.clone().normalize().multiply(this.speed)); @@ -194,7 +192,7 @@ public class AirStream extends AirAbility implements ComboAbility { @Override public boolean isHarmlessAbility() { - return true; + return false; } @Override diff --git a/src/com/projectkorra/projectkorra/airbending/combo/Twister.java b/src/com/projectkorra/projectkorra/airbending/combo/Twister.java index 0c84fa89..0ef0f344 100644 --- a/src/com/projectkorra/projectkorra/airbending/combo/Twister.java +++ b/src/com/projectkorra/projectkorra/airbending/combo/Twister.java @@ -1,13 +1,5 @@ package com.projectkorra.projectkorra.airbending.combo; -import java.util.ArrayList; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.ComboAbility; @@ -15,6 +7,13 @@ import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformatio import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.util.ClickType; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import java.util.ArrayList; public class Twister extends AirAbility implements ComboAbility { @@ -142,12 +141,10 @@ public class Twister extends AirAbility implements ComboAbility { } for (final Entity entity : this.affectedEntities) { - final Vector forceDir = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc.clone().add(0, height, 0)); - if (entity instanceof Player) { - if (Commands.invincible.contains(((Player) entity).getName())) { - break; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } + final Vector forceDir = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc.clone().add(0, height, 0)); entity.setVelocity(forceDir.clone().normalize().multiply(0.3)); } } diff --git a/src/com/projectkorra/projectkorra/earthbending/Ripple.java b/src/com/projectkorra/projectkorra/earthbending/Ripple.java index 4e467f95..a8e09e33 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Ripple.java +++ b/src/com/projectkorra/projectkorra/earthbending/Ripple.java @@ -274,10 +274,8 @@ public class Ripple extends EarthAbility { } private void affect(final Entity entity) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - return; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + return; } if (entity instanceof LivingEntity) { DamageHandler.damageEntity(entity, this.damage, this); diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java index 37cc7eae..ab1c6a95 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java @@ -337,10 +337,8 @@ public class SurgeWave extends WaterAbility { } } if (knockback) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - continue; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } final Vector dir = direction.clone(); dir.setY(dir.getY() * this.knockup); diff --git a/src/com/projectkorra/projectkorra/waterbending/Torrent.java b/src/com/projectkorra/projectkorra/waterbending/Torrent.java index cd010b39..e5ac018d 100644 --- a/src/com/projectkorra/projectkorra/waterbending/Torrent.java +++ b/src/com/projectkorra/projectkorra/waterbending/Torrent.java @@ -1,12 +1,15 @@ package com.projectkorra.projectkorra.waterbending; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.concurrent.ConcurrentHashMap; - +import com.projectkorra.projectkorra.BendingPlayer; +import com.projectkorra.projectkorra.GeneralMethods; +import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.attribute.Attribute; +import com.projectkorra.projectkorra.avatar.AvatarState; +import com.projectkorra.projectkorra.command.Commands; +import com.projectkorra.projectkorra.util.*; +import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth; +import com.projectkorra.projectkorra.waterbending.util.WaterReturn; import org.apache.commons.lang3.tuple.Pair; import org.bukkit.Location; import org.bukkit.Material; @@ -16,20 +19,8 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.BendingPlayer; -import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; -import com.projectkorra.projectkorra.attribute.Attribute; -import com.projectkorra.projectkorra.avatar.AvatarState; -import com.projectkorra.projectkorra.command.Commands; -import com.projectkorra.projectkorra.util.BlockSource; -import com.projectkorra.projectkorra.util.ClickType; -import com.projectkorra.projectkorra.util.DamageHandler; -import com.projectkorra.projectkorra.util.ParticleEffect; -import com.projectkorra.projectkorra.util.TempBlock; -import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth; -import com.projectkorra.projectkorra.waterbending.util.WaterReturn; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; public class Torrent extends WaterAbility { @@ -551,10 +542,8 @@ public class Torrent extends WaterAbility { if (entity.getEntityId() == this.player.getEntityId()) { return; } - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - return; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + return; } double x, z, vx, vz, mag; double angle = 50; @@ -592,6 +581,9 @@ public class Torrent extends WaterAbility { if (entity.getEntityId() == this.player.getEntityId()) { return; } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || (entity instanceof Player && Commands.invincible.contains(((Player) entity).getName()))){ + return; + } if (direction.getY() > this.knockup) { direction.setY(this.knockup); } diff --git a/src/com/projectkorra/projectkorra/waterbending/TorrentWave.java b/src/com/projectkorra/projectkorra/waterbending/TorrentWave.java index 8b869d05..7b3320df 100644 --- a/src/com/projectkorra/projectkorra/waterbending/TorrentWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/TorrentWave.java @@ -150,10 +150,8 @@ public class TorrentWave extends WaterAbility { for (final Entity entity : indexList) { if (!this.affectedEntities.contains(entity)) { if (entity.getLocation().distanceSquared(location) <= 4) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - continue; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } this.affectedEntities.add(entity); this.affect(entity); diff --git a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsWhip.java b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsWhip.java index 0ca6fd7d..a70ccfbf 100644 --- a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsWhip.java +++ b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsWhip.java @@ -293,10 +293,8 @@ public class WaterArmsWhip extends WaterAbility { switch (this.ability) { case PULL: for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - continue; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } final Vector vector = endOfArm.toVector().subtract(entity.getLocation().toVector()); entity.setVelocity(vector.multiply(this.pullMultiplier)); @@ -304,10 +302,8 @@ public class WaterArmsWhip extends WaterAbility { break; case PUNCH: for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - continue; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } final Vector vector = entity.getLocation().toVector().subtract(endOfArm.toVector()); @@ -327,10 +323,8 @@ public class WaterArmsWhip extends WaterAbility { if (this.grabbedEntity == null) { for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) { if (entity instanceof LivingEntity && entity.getEntityId() != this.player.getEntityId() && !GRABBED_ENTITIES.containsKey(entity)) { - if (entity instanceof Player) { - if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){ - continue; - } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){ + continue; } GRABBED_ENTITIES.put((LivingEntity) entity, this); this.grabbedEntity = (LivingEntity) entity;