Class AbilityUseEvent

java.lang.Object
com.ohacd.matchbox.api.MatchboxEvent
com.ohacd.matchbox.api.events.AbilityUseEvent

public class AbilityUseEvent extends MatchboxEvent
Event fired when a player uses a special ability.
Since:
0.9.5
  • Constructor Details

    • AbilityUseEvent

      public AbilityUseEvent(@NotNull @NotNull String sessionName, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull AbilityUseEvent.AbilityType ability, @Nullable @Nullable org.bukkit.entity.Player target)
      Creates a new ability use event.
      Parameters:
      sessionName - the session name
      player - the player using the ability
      ability - the type of ability used
      target - the target player (may be null for self-targeted abilities)
  • Method Details

    • dispatch

      public void dispatch(@NotNull @NotNull MatchboxEventListener listener)
      Description copied from class: MatchboxEvent
      Dispatches this event to the appropriate listener method.

      This method uses the visitor pattern to call the correct handler method based on the concrete event type. Implementing classes should call super.dispatch(listener) as the first line.

      Specified by:
      dispatch in class MatchboxEvent
      Parameters:
      listener - the listener to dispatch to
    • getSessionName

      @NotNull public @NotNull String getSessionName()
      Gets the name of the session where the ability was used.
      Returns:
      the session name
    • getPlayer

      @NotNull public @NotNull org.bukkit.entity.Player getPlayer()
      Gets the player who used the ability.
      Returns:
      the player
    • getAbility

      @NotNull public @NotNull AbilityUseEvent.AbilityType getAbility()
      Gets the type of ability that was used.
      Returns:
      the ability type
    • getTarget

      @Nullable public @Nullable org.bukkit.entity.Player getTarget()
      Gets the target player of the ability.
      Returns:
      the target player, or null if the ability is self-targeted