Class EntityPotionEffectEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityPotionEffectEvent
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescriptionstatic enumAn enum to specify the action to be performed.static enumAn enum to specify the cause why an effect was changed.Nested classes/interfaces inherited from class Event
Event.Result -
Field Summary
Fields inherited from class EntityEvent
entity -
Constructor Summary
ConstructorsConstructorDescriptionEntityPotionEffectEvent(LivingEntity livingEntity, @Nullable PotionEffect oldEffect, @Nullable PotionEffect newEffect, @Nullable Entity entitySource, EntityPotionEffectEvent.Cause cause, EntityPotionEffectEvent.Action action, boolean override) -
Method Summary
Modifier and TypeMethodDescriptionGets the action which will be performed on the potion effect type.getCause()Gets the cause why the effect has changed.Returns the Entity involved in this eventstatic HandlerListGets the modified potion effect type.Gets new potion effect of the changed type to be applied.Gets the old potion effect of the changed type, which will be removed.Gets the entity which caused the effect to change (Not applicable forEntityPotionEffectEvent.Action.REMOVED).booleanGets the cancellation state of this event.booleanReturns if the new potion effect will override the old potion effect (Only applicable forEntityPotionEffectEvent.Action.CHANGED).voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetOverride(boolean override) Sets if the new potion effect will override the old potion effect (Only applicable forEntityPotionEffectEvent.Action.CHANGED).Methods inherited from class EntityEvent
getEntityTypeMethods inherited from class Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
EntityPotionEffectEvent
@Internal public EntityPotionEffectEvent(LivingEntity livingEntity, @Nullable PotionEffect oldEffect, @Nullable PotionEffect newEffect, @Nullable Entity entitySource, EntityPotionEffectEvent.Cause cause, EntityPotionEffectEvent.Action action, boolean override)
-
-
Method Details
-
getEntity
Description copied from class:EntityEventReturns the Entity involved in this event- Overrides:
getEntityin classEntityEvent- Returns:
- Entity who is involved in this event
-
getOldEffect
Gets the old potion effect of the changed type, which will be removed.- Returns:
- The old potion effect or
nullif the entity did not have the changed effect type.
-
getNewEffect
Gets new potion effect of the changed type to be applied.- Returns:
- The new potion effect or
nullif the effect of the changed type will be removed.
-
getSource
Gets the entity which caused the effect to change (Not applicable forEntityPotionEffectEvent.Action.REMOVED).- Returns:
- The entity which caused the effect to change or
null
-
getCause
Gets the cause why the effect has changed.- Returns:
- A Cause value why the effect has changed.
-
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
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 forEntityPotionEffectEvent.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 forEntityPotionEffectEvent.Action.CHANGED).- Parameters:
override- If the new effect will override the old one.
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableGets 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:
isCancelledin interfaceCancellable- Returns:
trueif this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableSets 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:
setCancelledin interfaceCancellable- Parameters:
cancel-trueif you wish to cancel this event
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-