public class EntityPotionEffectEvent extends EntityEvent implements Cancellable
If the event is cancelled, no change will be made on the entity.
Modifier and Type | Class and 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.
|
Event.Result
entity
Constructor and Description |
---|
EntityPotionEffectEvent(@NotNull LivingEntity livingEntity,
@Nullable PotionEffect oldEffect,
@Nullable PotionEffect newEffect,
@NotNull EntityPotionEffectEvent.Cause cause,
@NotNull EntityPotionEffectEvent.Action action,
boolean override) |
Modifier and Type | Method and 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).
|
getEntity, getEntityType
callEvent, getEventName, isAsynchronous
@Contract(value="_, 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)
@Nullable public @Nullable PotionEffect getOldEffect()
@Nullable public @Nullable PotionEffect getNewEffect()
@NotNull public @NotNull EntityPotionEffectEvent.Cause getCause()
@NotNull public @NotNull EntityPotionEffectEvent.Action getAction()
@NotNull public @NotNull PotionEffectType getModifiedType()
public boolean isOverride()
public void setOverride(boolean override)
override
- If the new effect will override the old one.public boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this event@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2021. All rights reserved.