Search in sources :

Example 61 with PotionEffect

use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.

the class PotionEffectApplier method effectApplier.

private void effectApplier(ItemStack key, Player player) {
    for (PotionEffect potionEffect : potionEffectItemList.get(key)) {
        //night vision getting deleted and put back is extremely jarring, bypass
        if (potionEffect.getType().equals(PotionEffectType.NIGHT_VISION)) {
            player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 20 * 60, 1));
        } else {
            //Bypass due to minecraft not reapplying time correctly
            player.removePotionEffect(potionEffect.getType());
            player.addPotionEffect(potionEffect);
        }
    }
}
Also used : PotionEffect(org.bukkit.potion.PotionEffect)

Example 62 with PotionEffect

use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.

the class AttackBlinding method attackBlinding.

@EventHandler
public void attackBlinding(EntityDamageByEntityEvent event) {
    Entity damager = event.getDamager();
    Entity damagee = event.getEntity();
    if (damager.hasMetadata(powerMetadata)) {
        if (damagee instanceof Player) {
            Player player = (Player) damagee;
            player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20 * 5, 3));
        }
    } else if (damager instanceof Projectile && damagee instanceof Player) {
        if (ProjectileMetadataDetector.projectileMetadataDetector((Projectile) damager, powerMetadata)) {
            Player player = (Player) damagee;
            player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20 * 5, 3));
        }
    }
}
Also used : Entity(org.bukkit.entity.Entity) Player(org.bukkit.entity.Player) PotionEffect(org.bukkit.potion.PotionEffect) Projectile(org.bukkit.entity.Projectile) EventHandler(org.bukkit.event.EventHandler)

Example 63 with PotionEffect

use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.

the class AttackPoison method onHit.

@EventHandler
public void onHit(EntityDamageByEntityEvent event) {
    Entity damager = event.getDamager();
    Entity damagee = event.getEntity();
    if (damager.hasMetadata(powerMetadata) && damagee instanceof LivingEntity) {
        ((LivingEntity) damagee).addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
    }
    if (damager instanceof Projectile) {
        if (ProjectileMetadataDetector.projectileMetadataDetector((Projectile) damager, powerMetadata)) {
            ((LivingEntity) damagee).addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
        }
    }
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) Entity(org.bukkit.entity.Entity) LivingEntity(org.bukkit.entity.LivingEntity) PotionEffect(org.bukkit.potion.PotionEffect) Projectile(org.bukkit.entity.Projectile) EventHandler(org.bukkit.event.EventHandler)

Example 64 with PotionEffect

use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.

the class AttackWeakness method attackWeakness.

@EventHandler
public void attackWeakness(EntityDamageByEntityEvent event) {
    Entity damager = event.getDamager();
    Entity damagee = event.getEntity();
    if (damager.hasMetadata(powerMetadata)) {
        if (damagee instanceof Player) {
            Player player = (Player) damagee;
            player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 20 * 3, 0));
        }
    } else if (damager instanceof Projectile && damagee instanceof Player) {
        if (ProjectileMetadataDetector.projectileMetadataDetector((Projectile) damager, powerMetadata)) {
            Player player = (Player) damagee;
            player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 20 * 3, 0));
        }
    }
}
Also used : Entity(org.bukkit.entity.Entity) Player(org.bukkit.entity.Player) PotionEffect(org.bukkit.potion.PotionEffect) Projectile(org.bukkit.entity.Projectile) EventHandler(org.bukkit.event.EventHandler)

Example 65 with PotionEffect

use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.

the class Invisibility method applyPowers.

@Override
public void applyPowers(Entity entity) {
    entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
    ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
    MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
    minorPowerPowerStance.itemEffect(entity);
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) PotionEffect(org.bukkit.potion.PotionEffect) FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) MinorPowerPowerStance(com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance)

Aggregations

PotionEffect (org.bukkit.potion.PotionEffect)87 Player (org.bukkit.entity.Player)28 Location (org.bukkit.Location)16 LivingEntity (org.bukkit.entity.LivingEntity)13 ArrayList (java.util.ArrayList)12 PotionEffectType (org.bukkit.potion.PotionEffectType)12 EventHandler (org.bukkit.event.EventHandler)11 ItemStack (org.bukkit.inventory.ItemStack)10 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)9 Entity (org.bukkit.entity.Entity)9 Projectile (org.bukkit.entity.Projectile)6 Minigame (au.com.mineauz.minigames.minigame.Minigame)3 List (java.util.List)3 Vector (org.bukkit.util.Vector)3 LoadoutAddon (au.com.mineauz.minigames.minigame.modules.LoadoutModule.LoadoutAddon)2 MinorPowerPowerStance (com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance)2 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 SQLException (java.sql.SQLException)2 net.aufdemrand.denizen.objects.dEntity (net.aufdemrand.denizen.objects.dEntity)2