Class PlayerLeaveGameEvent
java.lang.Object
org.bukkit.event.Event
dev.despical.whackme.api.event.WhackMeEvent
dev.despical.whackme.api.event.player.PlayerEvent
dev.despical.whackme.api.event.player.PlayerLeaveGameEvent
Called immediately before a player is removed from a Whack Me game.
At dispatch time the player and their temporary run statistics are still
attached to the Game; cleanup, teleportation, and temporary-stat
reset have not run yet. The event is therefore suitable for analytics,
custom announcements, or capturing final run data.
@EventHandler
public void onLeave(PlayerLeaveGameEvent event) {
plugin.getLogger().info(event.getPlayer().getName()
+ " left because of " + event.getReason());
}
API Note: This event is informational and cannot prevent the player from leaving the game.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDescribes why a player is being removed from a game.Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPlayerLeaveGameEvent(org.bukkit.entity.Player player, Game game, PlayerLeaveGameEvent.LeaveReason reason) Creates a player leave event. -
Method Summary
Modifier and TypeMethodDescriptiongetGame()Returns the game the player is leaving.static org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListReturns the cause of the departure.Methods inherited from class PlayerEvent
getPlayer, getUser, toStringMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerLeaveGameEvent
public PlayerLeaveGameEvent(org.bukkit.entity.Player player, Game game, PlayerLeaveGameEvent.LeaveReason reason) Creates a player leave event.- Parameters:
player- player leaving the gamegame- game the player is leavingreason- reason that initiated the departure
-
-
Method Details
-
getGame
-
getReason
Returns the cause of the departure.- Returns:
- leave reason
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()
-