When listening to the "EntityPotionEffectEvent" and retrieving the new applied effect with event#getNewEffect() and then getting the type of the PotionEffect , the type does not match with the APIs PotionEffectType enums.
I cannot see a reason for this to not be working if not because of a spigot bug\improper code.
// java @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onEntityPotionEffect(final EntityPotionEffectEvent event) { final Entity entity = event.getEntity(); if (!(entity instanceof LivingEntity)) return; final LivingEntity livingEntity = (LivingEntity) entity; final EntityPotionEffectEvent.Action action = event.getAction(); final EntityPotionEffectEvent.Cause cause = event.getCause(); final PotionEffect potionEffect = event.getNewEffect(); if (potionEffect == null) return; final PotionEffectType potionEffectType = potionEffect.getType(); if (potionEffectType != PotionEffectType.POISON) { System.out.println(String.format("This is not poison, it is %s", potionEffectType.getName())); return; }
When a poison potion effect gets applied to the player, either via a bottle, or via the command "/effect give TheViperShow poison 15 0" , the condition that check that the potionEffectType is NOT EQUAL to Poison , always fails, however it prints this:
NOTE: This bugs also affects many other versions, I've tested 1.15.2 and 1.14.4 which had the same exact issue.