Class SwipeEvent

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

public class SwipeEvent extends MatchboxEvent
Event fired when the swipe action is performed (Spark attacks another player).
Since:
0.9.5
  • Constructor Details

    • SwipeEvent

      public SwipeEvent(@NotNull @NotNull String sessionName, @NotNull @NotNull org.bukkit.entity.Player attacker, @NotNull @NotNull org.bukkit.entity.Player victim, boolean successful)
      Creates a new swipe event.
      Parameters:
      sessionName - the session name
      attacker - the player performing the swipe (should be Spark)
      victim - the player being attacked
      successful - whether the swipe was successful (not blocked/cured)
  • 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 swipe occurred.
      Returns:
      the session name
    • getAttacker

      @NotNull public @NotNull org.bukkit.entity.Player getAttacker()
      Gets the player who performed the swipe attack.
      Returns:
      the attacker
    • getVictim

      @NotNull public @NotNull org.bukkit.entity.Player getVictim()
      Gets the player who was attacked.
      Returns:
      the victim
    • isSuccessful

      public boolean isSuccessful()
      Gets whether the swipe was successful.
      Returns:
      true if the swipe infected the target, false if it was blocked or cured