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

下面列出了怎么用org.bukkit.event.entity.PotionEffectRemoveEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: PGM   文件: 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);
    }
  }
}
 
源代码2 项目: 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);
        }
    }
}
 
源代码3 项目: PGM   文件: ShieldMatchModule.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPotionRemove(PotionEffectRemoveEvent event) {
  ShieldPlayerModule shield = getShield(event.getEntity());
  if (shield != null) shield.onEvent(event);
}
 
源代码4 项目: 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);
}
 
源代码5 项目: CardinalPGM   文件: ObserverModule.java
@EventHandler(priority = EventPriority.MONITOR)
public void onViewingEntityRemoveEffect(PotionEffectRemoveEvent event) {
    if (event.getEntity() instanceof Player) {
        updateNextTick((Player)event.getEntity());
    }
}
 
 类所在包
 类方法
 同包方法