Annotation Interface PlayerCache


@Target(FIELD) @Retention(RUNTIME) public @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 as Map<UUID, Map<String, Long>>) is removed via remove(uuid).
  • Set<UUID> -- the UUID itself is removed via remove(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 Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    If true, the framework will call the bean's savePlayerData(UUID) method (if it implements PlayerCacheSaver) before removing the entry.
  • Element Details

    • saveBeforeRemove

      boolean saveBeforeRemove
      If true, the framework will call the bean's savePlayerData(UUID) method (if it implements PlayerCacheSaver) before removing the entry.
      Returns:
      whether to save before removing
      Default:
      false