Package com.ohacd.matchbox.api.events
Class PlayerEliminateEvent
java.lang.Object
com.ohacd.matchbox.api.MatchboxEvent
com.ohacd.matchbox.api.events.PlayerEliminateEvent
Event fired when a player is eliminated from the game.
- Since:
- 0.9.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumReasons why a player can be eliminated. -
Constructor Summary
ConstructorsConstructorDescriptionPlayerEliminateEvent(String sessionName, org.bukkit.entity.Player eliminatedPlayer, com.ohacd.matchbox.game.utils.Role role, PlayerEliminateEvent.EliminationReason reason) Creates a new player elimination event.PlayerEliminateEvent(String sessionName, org.bukkit.entity.Player eliminatedPlayer, com.ohacd.matchbox.game.utils.Role role, PlayerEliminateEvent.EliminationReason reason, long timestamp) Creates a new player elimination event with explicit timestamp. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatch(MatchboxEventListener listener) Dispatches this event to the appropriate listener method.@NotNull org.bukkit.entity.PlayerGets the player who was eliminated.Gets the reason for the elimination.@NotNull com.ohacd.matchbox.game.utils.RolegetRole()Gets the role of the eliminated player.@NotNull StringGets the name of the session where the elimination occurred.toString()Methods inherited from class com.ohacd.matchbox.api.MatchboxEvent
getTimestamp
-
Constructor Details
-
PlayerEliminateEvent
public PlayerEliminateEvent(String sessionName, org.bukkit.entity.Player eliminatedPlayer, com.ohacd.matchbox.game.utils.Role role, PlayerEliminateEvent.EliminationReason reason) Creates a new player elimination event.- Parameters:
sessionName- the session where elimination occurredeliminatedPlayer- the player who was eliminatedrole- the role of the eliminated playerreason- the reason for elimination
-
PlayerEliminateEvent
public PlayerEliminateEvent(String sessionName, org.bukkit.entity.Player eliminatedPlayer, com.ohacd.matchbox.game.utils.Role role, PlayerEliminateEvent.EliminationReason reason, long timestamp) Creates a new player elimination event with explicit timestamp.- Parameters:
sessionName- the session where elimination occurredeliminatedPlayer- the player who was eliminatedrole- the role of the eliminated playerreason- the reason for eliminationtimestamp- epoch millis when the event occurred
-
-
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 elimination occurred.- Returns:
- the session name
-
getPlayer
@NotNull public @NotNull org.bukkit.entity.Player getPlayer()Gets the player who was eliminated.- Returns:
- the eliminated player
-
getRole
@NotNull public @NotNull com.ohacd.matchbox.game.utils.Role getRole()Gets the role of the eliminated player.- Returns:
- the player's role
-
getReason
Gets the reason for the elimination.- Returns:
- the elimination reason
-
toString
- Overrides:
toStringin classMatchboxEvent
-