Java 类org.bukkit.event.entity.PotionEffectAddEvent 实例源码

项目:HCFCore    文件:BeaconStrengthFixListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPotionEffectAdd(PotionEffectAddEvent event) {
    LivingEntity entity = event.getEntity();
    if (entity instanceof Player && event.getCause() == PotionEffectAddEvent.EffectCause.BEACON) {
        PotionEffect effect = event.getEffect();
        if (effect.getAmplifier() > 1 && effect.getType().equals(PotionEffectType.INCREASE_DAMAGE)) {
            entity.addPotionEffect(new PotionEffect(effect.getType(), effect.getDuration(), 0, effect.isAmbient()));
            event.setCancelled(true);
        }
    }
}
项目:HCFCore    文件:BeaconStrengthFixListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPotionEffectAdd(PotionEffectAddEvent event) {
    LivingEntity entity = event.getEntity();
    if (entity instanceof Player && event.getCause() == PotionEffectAddEvent.EffectCause.BEACON) {
        PotionEffect effect = event.getEffect();
        if (effect.getAmplifier() > 1 && effect.getType().equals(PotionEffectType.INCREASE_DAMAGE)) {
            entity.addPotionEffect(new PotionEffect(effect.getType(), effect.getDuration(), 0, effect.isAmbient()));
            event.setCancelled(true);
        }
    }
}
项目:Arcade2    文件:ObserverListeners.java   
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPotionEffectAdd(PotionEffectAddEvent event) {
    if (this.isObserving(event.getEntity())) {
        event.setCancelled(true);
    }
}
项目:CardinalPGM    文件:ObserverModule.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onViewingEntityAddEffect(PotionEffectAddEvent event) {
    if (event.getEntity() instanceof Player) {
        updateNextTick((Player)event.getEntity());
    }
}