@EventHandler public void onPotionLinger(final AreaEffectCloudApplyEvent event) { final AreaEffectCloud cloud = event.getEntity(); if(PotionClassification.classify(cloud) != PotionClassification.HARMFUL) return; for(Iterator<LivingEntity> iterator = event.getAffectedEntities().iterator(); iterator.hasNext(); ) { final LivingEntity victim = iterator.next(); final ParticipantState victimState = getMatch().getParticipantState(victim); final DamageInfo damageInfo = damageResolver.resolveDamage(EntityDamageEvent.DamageCause.MAGIC, victim, cloud); if(victimState != null && queryDamage(event, victimState, damageInfo).isDenied()) { iterator.remove(); } } }
public static LingeringPotionSplashEvent callLingeringPotionSplashEvent(EntityPotion potion, EntityAreaEffectCloud cloud) { ThrownPotion thrownPotion = (ThrownPotion) potion.getBukkitEntity(); AreaEffectCloud effectCloud = (AreaEffectCloud) cloud.getBukkitEntity(); LingeringPotionSplashEvent event = new LingeringPotionSplashEvent(thrownPotion, effectCloud); Bukkit.getPluginManager().callEvent(event); return event; }
public static Collection<PotionEffect> effects(AreaEffectCloud cloud) { return effects(cloud.getBasePotionData(), cloud.getCustomEffects()); }
public static AreaEffectCloudApplyEvent callAreaEffectCloudApplyEvent(EntityAreaEffectCloud cloud, List<LivingEntity> entities) { AreaEffectCloudApplyEvent event = new AreaEffectCloudApplyEvent((AreaEffectCloud) cloud.getBukkitEntity(), entities); cloud.world.getServer().getPluginManager().callEvent(event); return event; }