PlayerListener

class PlayerListener(plugin: CorePlugin) : Listener

PlayerListener - Core Event Handler for Player Management

This listener class handles all critical player-related events in the MCMMO Core plugin. It manages the complete player lifecycle including data loading, initialization, welcome messaging, and cleanup procedures when players connect and disconnect.

Key Responsibilities:

  • Player data loading and initialization during login

  • Welcome message display with customizable formatting

  • Player data persistence and cleanup during logout

  • Debug logging for player session management

Event Processing Order:

  1. PlayerLoginEvent (LOWEST priority) - Data loading

  2. PlayerJoinEvent (MONITOR priority) - Welcome messages

  3. PlayerQuitEvent (MONITOR priority) - Data saving and cleanup

Author

Your Team Name

Since

Plugin Version

Parameters

plugin

The main CorePlugin instance that provides access to: - Player data management functions - Configuration settings - Logging utilities

See also

For main plugin functionality

Listener

For Bukkit event handling interface

Constructors

Link copied to clipboard
constructor(plugin: CorePlugin)

Creates a new PlayerListener instance bound to the specified CorePlugin

Functions

Link copied to clipboard
fun onPlayerJoin(event: PlayerJoinEvent)

Handles player join events - Manages welcome messages and post-join procedures

Link copied to clipboard
fun onPlayerLogin(event: PlayerLoginEvent)

Handles player login events - CRITICAL for data initialization

Link copied to clipboard
fun onPlayerQuit(event: PlayerQuitEvent)

Handles player quit events - Critical for data persistence and cleanup