Search in sources :

Example 16 with PotionEffect

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

the class AttackGravity method attackGravity.

@EventHandler
public void attackGravity(EntityDamageByEntityEvent event) {
    Entity damager = event.getDamager();
    Entity damagee = event.getEntity();
    if (damager.hasMetadata(powerMetadata) && damagee instanceof LivingEntity) {
        ((LivingEntity) damagee).addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 2 * 20, 1));
    }
    if (damager instanceof Projectile) {
        if (ProjectileMetadataDetector.projectileMetadataDetector(((Projectile) damager), powerMetadata)) {
            ((LivingEntity) damagee).addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 2 * 20, 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 17 with PotionEffect

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

the class AttackConfusing method attackConfusing.

@EventHandler
public void attackConfusing(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.CONFUSION, 20 * 10, 3));
        }
    } else if (damager instanceof Projectile && damagee instanceof Player) {
        if (ProjectileMetadataDetector.projectileMetadataDetector((Projectile) damager, powerMetadata)) {
            Player player = (Player) damagee;
            player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 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 18 with PotionEffect

use of org.bukkit.potion.PotionEffect in project Glowstone by GlowstoneMC.

the class GlowMetaPotion method fromNBT.

public static PotionEffect fromNBT(CompoundTag tag) {
    PotionEffectType type = PotionEffectType.getById(tag.getByte("Id"));
    int duration = tag.getInt("Duration");
    int amplifier = tag.getByte("Amplifier");
    boolean ambient = tag.isByte("Ambient") && tag.getBool("Ambient");
    boolean particles = !tag.isByte("ShowParticles") || tag.getBool("ShowParticles");
    return new PotionEffect(type, duration, amplifier, ambient, particles);
}
Also used : PotionEffect(org.bukkit.potion.PotionEffect) PotionEffectType(org.bukkit.potion.PotionEffectType)

Example 19 with PotionEffect

use of org.bukkit.potion.PotionEffect in project Glowstone by GlowstoneMC.

the class GlowBeacon method setPrimaryEffect.

@Override
public void setPrimaryEffect(PotionEffectType primary) {
    this.primaryEffect = new PotionEffect(primary, 7, getTier(), true);
    getBlockEntity().setPrimaryId(primary.getId());
}
Also used : PotionEffect(org.bukkit.potion.PotionEffect)

Example 20 with PotionEffect

use of org.bukkit.potion.PotionEffect in project MyMaid2 by jaoafa.

the class Event_Antijaoium method isjaoium.

/**
 * jaoiumと判定されるアイテムかどうか
 * @param list PotionEffectのList
 * @return jaoiumかどうか
 * @author mine_book000
 */
private boolean isjaoium(List<PotionEffect> list) {
    HEAL_jaoium.add(-3);
    HEAL_jaoium.add(29);
    HEAL_jaoium.add(125);
    HEAL_jaoium.add(253);
    HEALTH_BOOST_jaoium.add(-7);
    Boolean jaoium = false;
    for (PotionEffect po : list) {
        if (po.getType().equals(PotionEffectType.HEAL)) {
            if (HEAL_jaoium.contains(po.getAmplifier())) {
                // アウト
                jaoium = true;
            }
        }
        if (po.getType().equals(PotionEffectType.HEALTH_BOOST)) {
            if (HEALTH_BOOST_jaoium.contains(po.getAmplifier())) {
                // アウト
                jaoium = true;
            }
        }
    }
    return jaoium;
}
Also used : PotionEffect(org.bukkit.potion.PotionEffect)

Aggregations

PotionEffect (org.bukkit.potion.PotionEffect)224 Player (org.bukkit.entity.Player)61 PotionEffectType (org.bukkit.potion.PotionEffectType)39 Location (org.bukkit.Location)37 LivingEntity (org.bukkit.entity.LivingEntity)37 EventHandler (org.bukkit.event.EventHandler)36 ItemStack (org.bukkit.inventory.ItemStack)34 ArrayList (java.util.ArrayList)31 Entity (org.bukkit.entity.Entity)23 PotionMeta (org.bukkit.inventory.meta.PotionMeta)18 Vector (org.bukkit.util.Vector)16 Random (java.util.Random)14 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)11 ItemMeta (org.bukkit.inventory.meta.ItemMeta)10 ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)9 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)9 Material (org.bukkit.Material)7 Enchantment (org.bukkit.enchantments.Enchantment)7 Projectile (org.bukkit.entity.Projectile)7 PotionData (org.bukkit.potion.PotionData)7