Annotation Interface PlayerCache
Marks a field for automatic cleanup when a player quits.
Three field shapes are accepted, and PlayerCacheManager
refuses (throws at registration) any other shape rather than silently ignoring it:
Map<UUID, ?>-- the whole entry (key and value, including a nested value such asMap<UUID, Map<String, Long>>) is removed viaremove(uuid).Set<UUID>-- the UUID itself is removed viaremove(uuid).Map<?, UUID>-- every entry whose VALUE equals the quitting player's UUID is removed; entries belonging to other players are left intact.
- Since:
- 6.2.0
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIf true, the framework will call the bean'ssavePlayerData(UUID)method (if it implementsPlayerCacheSaver) before removing the entry.
-
Element Details
-
saveBeforeRemove
boolean saveBeforeRemoveIf true, the framework will call the bean'ssavePlayerData(UUID)method (if it implementsPlayerCacheSaver) before removing the entry.This orders the save before the removal; it does not make the removal conditional on the save. If
savePlayerDatathrows, the failure is logged as a WARNING naming the bean class, the field and the player, the entry is removed anyway, and the cleanup of every other@PlayerCachefield continues (as of 6.3.0, #643; maintainer decision, 2026-10-08). The framework does not retry the save; a module that must not lose the data retries or persists it itself, insidesavePlayerData.- Returns:
- whether to save before removing
- Default:
false
-