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