on Player Quit
Handles player quit events - Critical for data persistence and cleanup
This method executes at MONITOR priority to ensure it runs after all other quit event handlers, allowing other plugins to make final modifications to player data before it's saved and removed from memory.
Process Flow:
Retrieves the quitting player from the event
Initiates player data saving to persistent storage
Removes player data from memory cache to prevent memory leaks
Logs debug information if debug mode is enabled
Priority Explanation:
MONITOR priority ensures this runs after other plugins' quit handlers
Allows other systems to make final changes before data persistence
Guarantees all plugin modifications are saved before cache cleanup
Data Persistence Details:
savePlayerData parameter 'false' indicates this is a logout save
Data is written to persistent storage (database/file) before cache removal
Ensures no player progress is lost during server shutdown or crashes
Memory Management:
unloadPlayerData removes all cached data for the player's UUID
Prevents memory leaks in long-running server instances
Frees resources for other players and server operations
Debug Logging:
Conditional logging based on configuration setting
Provides visibility into player session management
Useful for troubleshooting data persistence issues
Parameters
The PlayerQuitEvent containing: - player: The Player object that is leaving the server - quitMessage: The default quit message (can be modified)
See also
For complete event details
For data persistence logic
For cache cleanup implementation
For debug configuration access
For debug logging functionality