Package com.ohacd.matchbox.api.events
Class PlayerLeaveEvent
java.lang.Object
com.ohacd.matchbox.api.MatchboxEvent
com.ohacd.matchbox.api.events.PlayerLeaveEvent
Event fired when a player leaves a game session.
- Since:
- 0.9.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumReasons why a player can leave a session. -
Constructor Summary
ConstructorsConstructorDescriptionPlayerLeaveEvent(@NotNull String sessionName, @NotNull org.bukkit.entity.Player player, @NotNull PlayerLeaveEvent.LeaveReason reason) Creates a new player leave 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 left the session.@NotNull PlayerLeaveEvent.LeaveReasonGets the reason why the player left.@NotNull StringGets the name of the session the player left.Methods inherited from class com.ohacd.matchbox.api.MatchboxEvent
getTimestamp, toString
-
Constructor Details
-
PlayerLeaveEvent
public PlayerLeaveEvent(@NotNull @NotNull String sessionName, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull PlayerLeaveEvent.LeaveReason reason) Creates a new player leave event.- Parameters:
sessionName- the session nameplayer- the player who leftreason- the reason for leaving
-
-
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 the player left.- Returns:
- the session name
-
getPlayer
@NotNull public @NotNull org.bukkit.entity.Player getPlayer()Gets the player who left the session.- Returns:
- the player
-
getReason
Gets the reason why the player left.- Returns:
- the leave reason
-