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);
}
}
}
Aggregations