Search in sources :

Example 6 with BendingPlayer

use of com.projectkorra.projectkorra.BendingPlayer in project Spirits by xNuminousx.

the class PassiveListener method onFallDamage.

@EventHandler
public void onFallDamage(EntityDamageEvent event) {
    if (event.getEntity() instanceof Player) {
        Element spirit = Element.getElement("Spirit");
        Player player = (Player) event.getEntity();
        BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
        if (event.isCancelled() || bPlayer == null || bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.EARTH)) {
            return;
        } else if (bPlayer.hasElement(spirit) && event.getCause() == DamageCause.FALL) {
            event.setDamage(0D);
            event.setCancelled(true);
        }
    }
}
Also used : BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) Player(org.bukkit.entity.Player) Element(com.projectkorra.projectkorra.Element) EventHandler(org.bukkit.event.EventHandler)

Aggregations

BendingPlayer (com.projectkorra.projectkorra.BendingPlayer)6 Player (org.bukkit.entity.Player)6 EventHandler (org.bukkit.event.EventHandler)3 Random (java.util.Random)2 Shelter (me.xnuminousx.spirits.ability.light.Shelter)2 LivingEntity (org.bukkit.entity.LivingEntity)2 Monster (org.bukkit.entity.Monster)2 PotionEffect (org.bukkit.potion.PotionEffect)2 Element (com.projectkorra.projectkorra.Element)1 AvatarState (com.projectkorra.projectkorra.avatar.AvatarState)1 Intoxicate (me.xnuminousx.spirits.ability.dark.Intoxicate)1 Shackle (me.xnuminousx.spirits.ability.dark.Shackle)1 Strike (me.xnuminousx.spirits.ability.dark.Strike)1 Alleviate (me.xnuminousx.spirits.ability.light.Alleviate)1 Dash (me.xnuminousx.spirits.ability.spirit.Dash)1 Possess (me.xnuminousx.spirits.ability.spirit.Possess)1 Soar (me.xnuminousx.spirits.ability.spirit.Soar)1 Vanish (me.xnuminousx.spirits.ability.spirit.Vanish)1