use of org.bukkit.potion.PotionEffect in project Glowstone by GlowstoneMC.
the class BeaconEntity method applyPotionEffects.
private void applyPotionEffects() {
Beacon beacon = (Beacon) getBlock().getState();
beacon.getEntitiesInRange().forEach(livingEntity -> {
for (BeaconEffectPriority priority : BeaconEffectPriority.values()) {
PotionEffect effect = this.getEffect(priority);
if (effect == null) {
continue;
}
BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (Player) livingEntity, priority == BeaconEffectPriority.PRIMARY);
if (!EventFactory.getInstance().callEvent(event).isCancelled()) {
livingEntity.addPotionEffect(event.getEffect(), true);
}
}
});
}
use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.
the class EnderDragonEndermiteBombardment method taskBehavior.
@Override
public void taskBehavior(EliteEntity eliteEntity) {
try {
Vector direction = eliteEntity.getLivingEntity().getLocation().getDirection();
float rotation = (float) (Math.atan2(direction.getX(), direction.getZ()) * 180 / Math.PI);
Vector direction1 = new Vector(1, -4, 0);
Vector direction2 = new Vector(-1, -4, 0);
direction1 = direction1.rotateAroundY(rotation);
direction2 = direction2.rotateAroundY(rotation);
CustomBossEntity customBossEntity1 = CustomBossEntity.createCustomBossEntity("binder_of_worlds_phase_1_endermite_reinforcement.yml");
customBossEntity1.spawn(eliteEntity.getLivingEntity().getLocation().clone().add(direction1), false);
customBossEntity1.getLivingEntity().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20 * 5, 0));
eliteEntity.addReinforcement(customBossEntity1);
CustomBossEntity customBossEntity2 = CustomBossEntity.createCustomBossEntity("binder_of_worlds_phase_1_endermite_reinforcement.yml");
customBossEntity2.spawn(eliteEntity.getLivingEntity().getLocation().clone().add(direction2), false);
customBossEntity2.getLivingEntity().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20 * 5, 0));
eliteEntity.addReinforcement(customBossEntity2);
} catch (Exception ex) {
new WarningMessage("Failed to spawn binder of world's reinforcement endermite!");
}
}
use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.
the class AttackWeakness method attackWeakness.
@EventHandler
public void attackWeakness(PlayerDamagedByEliteMobEvent event) {
if (event.isCancelled())
return;
AttackWeakness attackWeakness = (AttackWeakness) event.getEliteMobEntity().getPower(this);
if (attackWeakness == null)
return;
if (attackWeakness.isInGlobalCooldown())
return;
attackWeakness.doGlobalCooldown(20 * 10);
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 20 * 3, 0));
}
use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.
the class AttackWither method onHit.
@EventHandler
public void onHit(PlayerDamagedByEliteMobEvent event) {
if (event.isCancelled())
return;
AttackWither attackWither = (AttackWither) event.getEliteMobEntity().getPower(this);
if (attackWither == null)
return;
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * 2, 1));
}
use of org.bukkit.potion.PotionEffect in project EliteMobs by MagmaGuy.
the class AttackPoison method onHit.
@EventHandler
public void onHit(PlayerDamagedByEliteMobEvent event) {
if (event.isCancelled())
return;
AttackPoison attackPoison = (AttackPoison) event.getEliteMobEntity().getPower(this);
if (attackPoison == null)
return;
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20 * 2, 3));
}
Aggregations