some more protection checks

This commit is contained in:
PhanaticD 2019-01-05 06:37:11 -05:00
parent 15ac7b6d5b
commit 0b45215636
2 changed files with 14 additions and 7 deletions

View file

@ -1,12 +1,5 @@
package com.projectkorra.projectkorra.chiblocking.combo;
import java.util.ArrayList;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility;
@ -14,8 +7,15 @@ import com.projectkorra.projectkorra.ability.ComboAbility;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.MovementHandler;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import java.util.ArrayList;
public class Immobilize extends ChiAbility implements ComboAbility {
@ -38,6 +38,9 @@ public class Immobilize extends ChiAbility implements ComboAbility {
this.remove();
return;
} else {
if (GeneralMethods.isRegionProtectedFromBuild(this, target.getLocation()) || ((target instanceof Player) && Commands.invincible.contains(((Player) target).getName()))){
return;
}
paralyze(this.target, this.duration);
this.bPlayer.addCooldown(this);
}

View file

@ -1,5 +1,6 @@
package com.projectkorra.projectkorra.waterbending.multiabilities;
import com.projectkorra.projectkorra.command.Commands;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -130,6 +131,9 @@ public class WaterArmsFreeze extends IceAbility {
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, 2.5)) {
if (entity instanceof LivingEntity && entity.getEntityId() != this.player.getEntityId() && !(entity instanceof ArmorStand)) {
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
continue;
}
DamageHandler.damageEntity(entity, this.iceDamage, this);
final PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 40, 2);
new TempPotionEffect((LivingEntity) entity, effect);