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

项目:ProjectAres    文件:ShieldPlayerModule.java   
void onEvent(PotionEffectRemoveEvent event) {
    // The NMS code assumes that a potion effect is the only way to get
    // absorption hearts, so when the effect is removed, it simply removes
    // the same amount of absorption that it added initially. If any of that
    // eats into the shield, we refund the difference.
    if(PotionEffectType.ABSORPTION.equals(event.getEffect().getType())) {
        double newAbsorption = Math.max(0, getAbsorption() - 4 * (1 + event.getEffect().getAmplifier()));
        if(newAbsorption < shieldHealth) {
            logger.fine("Compensating for removal of absorption " + event.getEffect().getAmplifier() +
                        " effect, which will reduce absorption hearts to " + newAbsorption +
                        ", which is below shield health of " + shieldHealth);
            addAbsorption(shieldHealth - newAbsorption);
        }
    }
}
项目:ProjectAres    文件:ShieldMatchModule.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPotionRemove(PotionEffectRemoveEvent event) {
    ShieldPlayerModule shield = getShield(event.getEntity());
    if(shield != null) shield.onEvent(event);
}
项目:Arcade2    文件:ObserverListeners.java   
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPotionEffectRemove(PotionEffectRemoveEvent event) {
    if (this.isObserving(event.getEntity())) {
        event.setCancelled(true);
    }
}
项目:CardinalPGM    文件:ObserverModule.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onViewingEntityRemoveEffect(PotionEffectRemoveEvent event) {
    if (event.getEntity() instanceof Player) {
        updateNextTick((Player)event.getEntity());
    }
}