Search in sources :

Example 1 with Element

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

the class Methods method playSpiritParticles.

public static void playSpiritParticles(BendingPlayer bPlayer, Location loc, float X, float Y, float Z, float speed, int amount) {
    Element ls = Element.getElement("LightSpirit");
    Element ds = Element.getElement("DarkSpirit");
    Element s = Element.getElement("Spirit");
    if (bPlayer.hasElement(ls) && bPlayer.hasElement(ds)) {
        ParticleEffect.MAGIC_CRIT.display(loc, X, Y, Z, speed, amount);
    } else if (bPlayer.hasElement(ds)) {
        ParticleEffect.WITCH_MAGIC.display(loc, X, Y, Z, speed, amount);
    } else if (bPlayer.hasElement(ls)) {
        ParticleEffect.INSTANT_SPELL.display(loc, X, Y, Z, speed, amount);
    } else if (!bPlayer.hasElement(ls) && !bPlayer.hasElement(ds) && bPlayer.hasElement(s)) {
        ParticleEffect.MAGIC_CRIT.display(loc, X, Y, Z, speed, amount);
    }
}
Also used : Element(com.projectkorra.projectkorra.Element)

Example 2 with Element

use of com.projectkorra.projectkorra.Element 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

Element (com.projectkorra.projectkorra.Element)2 BendingPlayer (com.projectkorra.projectkorra.BendingPlayer)1 Player (org.bukkit.entity.Player)1 EventHandler (org.bukkit.event.EventHandler)1