Package com.ohacd.matchbox.api.events
Class AbilityUseEvent
java.lang.Object
com.ohacd.matchbox.api.MatchboxEvent
com.ohacd.matchbox.api.events.AbilityUseEvent
Event fired when a player uses a special ability.
- Since:
- 0.9.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTypes of abilities that can be used. -
Constructor Summary
ConstructorsConstructorDescriptionAbilityUseEvent(@NotNull String sessionName, @NotNull org.bukkit.entity.Player player, @NotNull AbilityUseEvent.AbilityType ability, @Nullable org.bukkit.entity.Player target) Creates a new ability use event. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatch(@NotNull MatchboxEventListener listener) Dispatches this event to the appropriate listener method.@NotNull AbilityUseEvent.AbilityTypeGets the type of ability that was used.@NotNull org.bukkit.entity.PlayerGets the player who used the ability.@NotNull StringGets the name of the session where the ability was used.@Nullable org.bukkit.entity.PlayerGets the target player of the ability.Methods inherited from class com.ohacd.matchbox.api.MatchboxEvent
getTimestamp, toString
-
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 nameplayer- the player using the abilityability- the type of ability usedtarget- the target player (may be null for self-targeted abilities)
-
-
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 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
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
-