@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); } } }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPotionEffectAdd(PotionEffectAddEvent event) { if (this.isObserving(event.getEntity())) { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.MONITOR) public void onViewingEntityAddEffect(PotionEffectAddEvent event) { if (event.getEntity() instanceof Player) { updateNextTick((Player)event.getEntity()); } }