Package com.enhancedechest.listener
Class PlayerSettingsListener
java.lang.Object
com.enhancedechest.listener.PlayerSettingsListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Drives the lifecycle of per-player transient state around join/quit:
- Join: pin the player in the lazy storage cache (never evicted while online), then
preload their settings — the preload's
loadSettingscall is also what materializes the player's chest rows into the cache, so it doubles as the join prefetch and their first chest open touches no database. - Quit: stamp
last_online, evict the settings cache entry and the sort-cooldown timestamp, unpin the storage cache entry, and schedule the delayed write-back + eviction of their rows (AutosaveService.flushQuitterLater(java.util.UUID)) — so a leaver's changes reach the database within seconds and their memory is freed. A rejoin before that runs simply re-pins them; the eviction then declines and the still-warm rows are reused.
These handlers pair up exactly, so every per-player map stays bounded by the online-player count
and never leaks. (The join-then-immediate-quit race is handled inside
PlayerSettingsCache.preloadSettings(java.util.UUID, java.lang.String) for the settings cache, and by the clean-only eviction
inside CachedStorage for the storage cache.) Separate from JoinMigrationListener,
which early-returns when migration is off and so must not be relied on to run the preload.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PlayerSettingsListener
public PlayerSettingsListener()
-
-
Method Details
-
onJoin
public void onJoin(org.bukkit.event.player.PlayerJoinEvent event) -
onQuit
public void onQuit(org.bukkit.event.player.PlayerQuitEvent event)
-