Package org.bukkit.event.entity
Class EntityPotionEffectEvent
- java.lang.Object
-
- org.bukkit.event.Event
-
- org.bukkit.event.entity.EntityEvent
-
- org.bukkit.event.entity.EntityPotionEffectEvent
-
- All Implemented Interfaces:
Cancellable
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EntityPotionEffectEvent.Action
An enum to specify the action to be performed.static class
EntityPotionEffectEvent.Cause
An enum to specify the cause why an effect was changed.-
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
-
Field Summary
-
Fields inherited from class org.bukkit.event.entity.EntityEvent
entity
-
-
Constructor Summary
Constructors Constructor Description EntityPotionEffectEvent(@NotNull LivingEntity livingEntity, @Nullable PotionEffect oldEffect, @Nullable PotionEffect newEffect, @NotNull EntityPotionEffectEvent.Cause cause, @NotNull EntityPotionEffectEvent.Action action, boolean override)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull EntityPotionEffectEvent.Action
getAction()
Gets the action which will be performed on the potion effect type.@NotNull EntityPotionEffectEvent.Cause
getCause()
Gets the cause why the effect has changed.static @NotNull HandlerList
getHandlerList()
@NotNull HandlerList
getHandlers()
@NotNull PotionEffectType
getModifiedType()
Gets the modified potion effect type.@Nullable PotionEffect
getNewEffect()
Gets new potion effect of the changed type to be applied.@Nullable PotionEffect
getOldEffect()
Gets the old potion effect of the changed type, which will be removed.boolean
isCancelled()
Gets the cancellation state of this event.boolean
isOverride()
Returns if the new potion effect will override the old potion effect (Only applicable for the CHANGED Action).void
setCancelled(boolean cancel)
Sets the cancellation state of this event.void
setOverride(boolean override)
Sets if the new potion effect will override the old potion effect (Only applicable for the CHANGED action).-
Methods inherited from class org.bukkit.event.entity.EntityEvent
getEntity, getEntityType
-
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
-
-
-
Constructor Detail
-
EntityPotionEffectEvent
@Contract("_, null, null, _, _, _ -> fail") public EntityPotionEffectEvent(@NotNull @NotNull LivingEntity livingEntity, @Nullable @Nullable PotionEffect oldEffect, @Nullable @Nullable PotionEffect newEffect, @NotNull @NotNull EntityPotionEffectEvent.Cause cause, @NotNull @NotNull EntityPotionEffectEvent.Action action, boolean override)
-
-
Method Detail
-
getOldEffect
@Nullable 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
@Nullable 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.
-
getCause
@NotNull public @NotNull EntityPotionEffectEvent.Cause getCause()
Gets the cause why the effect has changed.- Returns:
- A Cause value why the effect has changed.
-
getAction
@NotNull public @NotNull 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
@NotNull public @NotNull 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 the CHANGED Action).- 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 the CHANGED action).- 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 interfaceCancellable
- 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 interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
@NotNull public @NotNull HandlerList getHandlers()
- Specified by:
getHandlers
in classEvent
-
getHandlerList
@NotNull public static @NotNull HandlerList getHandlerList()
-
-