restore previous behavior for airsuction where you could only affect yourself if a origin cloud was set

This commit is contained in:
PhanaticD 2019-01-06 10:22:09 -05:00
parent 1f72980dc8
commit 551de94f7e

View file

@ -45,6 +45,7 @@ public class AirSuction extends AirAbility {
private Location location;
private Location origin;
private Vector direction;
private boolean canAffectSelf;
public AirSuction(final Player player) {
super(player);
@ -78,6 +79,7 @@ public class AirSuction extends AirAbility {
this.cooldown = getConfig().getLong("Abilities.Air.AirSuction.Cooldown");
this.random = new Random();
this.origin = getTargetLocation();
this.canAffectSelf = true;
if (GeneralMethods.isRegionProtectedFromBuild(player, this.getName(), origin)) {
return;
@ -195,6 +197,9 @@ public class AirSuction extends AirAbility {
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
continue;
}
if((entity.getEntityId() == player.getEntityId()) && !canAffectSelf){
continue;
}
final Vector velocity = entity.getVelocity();
final double max = this.speed;
final Vector push = this.direction.clone();
@ -269,6 +274,7 @@ public class AirSuction extends AirAbility {
} else {
suc = new AirSuction(player);
suc.setOrigin(player.getEyeLocation().clone());
suc.setCanEffectSelf(false);
}
if (suc.getOrigin() != null) {
@ -393,6 +399,10 @@ public class AirSuction extends AirAbility {
this.cooldown = cooldown;
}
public void setCanEffectSelf(final boolean affect) {
this.canAffectSelf = affect;
}
public static int getSelectParticles() {
return getConfig().getInt("Abilities.Air.AirSuction.SelectParticles");
}