Class EntityPotionEffectEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityPotionEffectEvent
All Implemented Interfaces:
Cancellable

@NullMarked public class EntityPotionEffectEvent extends EntityEvent implements Cancellable
Called when a potion effect is modified on an entity.

If the event is cancelled, no change will be made on the entity.

  • Constructor Details

  • Method Details

    • getEntity

      public LivingEntity getEntity()
      Description copied from class: EntityEvent
      Returns the Entity involved in this event
      Overrides:
      getEntity in class EntityEvent
      Returns:
      Entity who is involved in this event
    • getOldEffect

      public @Nullable PotionEffect getOldEffect()
      Gets the old potion effect of the changed type, which will be removed.
      Returns:
      The old potion effect or null if the entity did not have the changed effect type.
    • getNewEffect

      public @Nullable PotionEffect getNewEffect()
      Gets new potion effect of the changed type to be applied.
      Returns:
      The new potion effect or null if the effect of the changed type will be removed.
    • getSource

      public @Nullable Entity getSource()
      Gets the entity which caused the effect to change (Not applicable for EntityPotionEffectEvent.Action.REMOVED).
      Returns:
      The entity which caused the effect to change or null
    • getCause

      public EntityPotionEffectEvent.Cause getCause()
      Gets the cause why the effect has changed.
      Returns:
      A Cause value why the effect has changed.
    • getAction

      public EntityPotionEffectEvent.Action getAction()
      Gets the action which will be performed on the potion effect type.
      Returns:
      An action to be performed on the potion effect type.
    • getModifiedType

      public PotionEffectType getModifiedType()
      Gets the modified potion effect type.
      Returns:
      The effect type which will be modified on the entity.
    • isOverride

      public boolean isOverride()
      Returns if the new potion effect will override the old potion effect (Only applicable for EntityPotionEffectEvent.Action.CHANGED).
      Returns:
      If the new effect will override the old one.
    • setOverride

      public void setOverride(boolean override)
      Sets if the new potion effect will override the old potion effect (Only applicable for EntityPotionEffectEvent.Action.CHANGED).
      Parameters:
      override - If the new effect will override the old one.
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if this event is cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: Cancellable
      Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()