Package com.ohacd.matchbox.api.events
Class SwipeEvent
java.lang.Object
com.ohacd.matchbox.api.MatchboxEvent
com.ohacd.matchbox.api.events.SwipeEvent
Event fired when the swipe action is performed (Spark attacks another player).
- Since:
- 0.9.5
-
Constructor Summary
ConstructorsConstructorDescriptionSwipeEvent(@NotNull String sessionName, @NotNull org.bukkit.entity.Player attacker, @NotNull org.bukkit.entity.Player victim, boolean successful) Creates a new swipe event. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatch(@NotNull MatchboxEventListener listener) Dispatches this event to the appropriate listener method.@NotNull org.bukkit.entity.PlayerGets the player who performed the swipe attack.@NotNull StringGets the name of the session where the swipe occurred.@NotNull org.bukkit.entity.PlayerGets the player who was attacked.booleanGets whether the swipe was successful.Methods inherited from class com.ohacd.matchbox.api.MatchboxEvent
getTimestamp, toString
-
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 nameattacker- the player performing the swipe (should be Spark)victim- the player being attackedsuccessful- whether the swipe was successful (not blocked/cured)
-
-
Method Details
-
dispatch
Description copied from class:MatchboxEventDispatches 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:
dispatchin classMatchboxEvent- Parameters:
listener- the listener to dispatch to
-
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
-