Class PlayerLeaveGameEvent

java.lang.Object
org.bukkit.event.Event

public final class PlayerLeaveGameEvent extends PlayerEvent
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.

  • 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 game
      game - game the player is leaving
      reason - reason that initiated the departure
  • Method Details

    • getGame

      public Game getGame()
      Returns the game the player is leaving.
      Returns:
      related game
    • getReason

      Returns the cause of the departure.
      Returns:
      leave reason
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()