Class PlayerPostEffectsModifyEvent

java.lang.Object
fr.fidorial.event.player.PlayerPostEffectsModifyEvent
All Implemented Interfaces:
Cancellable, Event, PlayerEvent

public final class PlayerPostEffectsModifyEvent extends Object implements PlayerEvent, Cancellable
Fired right before a player has their post effects modified.

Cancelling the event keeps their current post effects.

Since:
0.1.0
API Note:
the event is not fired whenever the underlying list of post effects hasn't changed
  • Constructor Details

    • PlayerPostEffectsModifyEvent

      @Internal public PlayerPostEffectsModifyEvent(Player player, PlayerPostEffectsModifyEvent.Cause cause, List<Key> currentPostEffects, List<Key> newPostEffects)
      Creates an event.
      Parameters:
      player - the player whose post effects are about to be changed
      cause - what triggered the change in active post effects
      currentPostEffects - the currently active post effects
      newPostEffects - the post effects about to be applied
      Since:
      0.1.0
  • Method Details

    • player

      public Player player()
      Description copied from interface: PlayerEvent
      Returns the player involved in this event.
      Specified by:
      player in interface PlayerEvent
      Returns:
      the player involved in this event
    • newPostEffects

      public @Unmodifiable List<Key> newPostEffects()
      Returns the new post effects.
      Returns:
      the new post effects
      Since:
      0.1.0
    • currentPostEffects

      public @Unmodifiable List<Key> currentPostEffects()
      Returns the current active post effects.
      Returns:
      the current active post effects
      Since:
      0.1.0
    • cause

      Returns what triggered the change in active post effects.
      Returns:
      what triggered the change in active post effects
      Since:
      0.1.0
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Returns true if the action this event describes will not happen.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the action this event describes will not happen
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Prevents or re-allows the action this event describes.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to prevent it