Search in sources :

Example 1 with BendingPlayer

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

the class Infest method infestEntities.

public void infestEntities(Entity entity) {
    if (new Random().nextInt(effectInt) == 0) {
        if (entity instanceof Player) {
            Player ePlayer = (Player) entity;
            BendingPlayer bEntity = BendingPlayer.getBendingPlayer(ePlayer);
            if (bEntity.hasElement(Element.getElement("DarkSpirit")) && healDarkSpirits) {
                LivingEntity le = (LivingEntity) entity;
                le.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 120, 1));
                ParticleEffect.HEART.display(entity.getLocation().add(0, 2, 0), 0, 0, 0, 0, 1);
            }
        } else if (entity instanceof Monster) {
            LivingEntity le = (LivingEntity) entity;
            le.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 120, 1));
            ParticleEffect.ANGRY_VILLAGER.display(entity.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1);
        } else if (entity instanceof LivingEntity && damageEntities) {
            DamageHandler.damageEntity(entity, damage, this);
            ParticleEffect.PORTAL.display(entity.getLocation().add(0, 1, 0), 0, 0, 0, 1.5F, 5);
        }
    }
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) Player(org.bukkit.entity.Player) Random(java.util.Random) PotionEffect(org.bukkit.potion.PotionEffect) Monster(org.bukkit.entity.Monster)

Example 2 with BendingPlayer

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

the class Fuse method defuse.

public void defuse() {
    if (player.getGameMode() == GameMode.SPECTATOR) {
        player.setSpectatorTarget(null);
        player.setGameMode(originGM);
    }
    if (target instanceof Player) {
        BendingPlayer bTarget = BendingPlayer.getBendingPlayer((Player) target);
        if (bTarget.isAvatarState()) {
            AvatarState avatarState = getAbility((Player) target, AvatarState.class);
            avatarState.remove();
        }
    }
}
Also used : BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) Player(org.bukkit.entity.Player) AvatarState(com.projectkorra.projectkorra.avatar.AvatarState)

Example 3 with BendingPlayer

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

the class AbilityListener method onSwing.

@EventHandler
public void onSwing(PlayerAnimationEvent event) {
    Player player = event.getPlayer();
    BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
    if (event.isCancelled() || bPlayer == null) {
        return;
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase(null)) {
        return;
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Agility")) {
        new Dash(player);
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Shackle")) {
        new Shackle(player);
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Shelter")) {
        new Shelter(player, ShelterType.CLICK);
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Strike")) {
        new Strike(player);
    }
}
Also used : BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) Player(org.bukkit.entity.Player) Dash(me.xnuminousx.spirits.ability.spirit.Dash) Strike(me.xnuminousx.spirits.ability.dark.Strike) Shelter(me.xnuminousx.spirits.ability.light.Shelter) Shackle(me.xnuminousx.spirits.ability.dark.Shackle) EventHandler(org.bukkit.event.EventHandler)

Example 4 with BendingPlayer

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

the class AbilityListener method onSneak.

@EventHandler
public void onSneak(PlayerToggleSneakEvent event) {
    Player player = event.getPlayer();
    BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
    if (event.isCancelled() || bPlayer == null) {
        return;
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase(null)) {
        return;
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Possess")) {
        new Possess(player);
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Alleviate")) {
        new Alleviate(player);
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Intoxicate")) {
        new Intoxicate(player);
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Agility")) {
        new Soar(player);
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Shelter")) {
        new Shelter(player, ShelterType.SHIFT);
    } else if (bPlayer.getBoundAbilityName().equalsIgnoreCase("Vanish")) {
        if (event.isSneaking()) {
            new Vanish(player);
        } else {
            return;
        }
    }
}
Also used : Possess(me.xnuminousx.spirits.ability.spirit.Possess) Intoxicate(me.xnuminousx.spirits.ability.dark.Intoxicate) Vanish(me.xnuminousx.spirits.ability.spirit.Vanish) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) Player(org.bukkit.entity.Player) Alleviate(me.xnuminousx.spirits.ability.light.Alleviate) Soar(me.xnuminousx.spirits.ability.spirit.Soar) Shelter(me.xnuminousx.spirits.ability.light.Shelter) EventHandler(org.bukkit.event.EventHandler)

Example 5 with BendingPlayer

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

the class Rejuvenate method healEntities.

public void healEntities(Entity entity) {
    if (new Random().nextInt(effectInt) == 0) {
        if (entity instanceof Player && damageDarkSpirits) {
            Player ePlayer = (Player) entity;
            BendingPlayer bEntity = BendingPlayer.getBendingPlayer(ePlayer);
            if (bEntity.hasElement(Element.getElement("DarkSpirit"))) {
                DamageHandler.damageEntity(ePlayer, damage, this);
            }
        } else if (entity instanceof Monster && damageMonsters) {
            DamageHandler.damageEntity(entity, damage, this);
        } else {
            LivingEntity le = (LivingEntity) entity;
            le.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 120, 1));
            ParticleEffect.HEART.display(entity.getLocation().add(0, 2, 0), 0, 0, 0, 0, 1);
        }
    }
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) BendingPlayer(com.projectkorra.projectkorra.BendingPlayer) Player(org.bukkit.entity.Player) Random(java.util.Random) PotionEffect(org.bukkit.potion.PotionEffect) Monster(org.bukkit.entity.Monster)

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