Class SocialRepository
java.lang.Object
net.flectone.pulse.data.repository.SocialRepository
Repository for managing social interactions and player data in FlectonePulse.
Handles ignore relationships, mail messages, color settings,
and player preferences with caching support.
- Since:
- 0.8.1
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSocialRepository(com.google.common.cache.Cache<UUID, Map<FColor.Type, Set<FColor>>> playerColorCache, com.google.common.cache.Cache<UUID, SocialRepository.Settings> playerSettingCache, com.google.common.cache.Cache<UUID, List<Ignore>> playerIgnoreCache, IgnoreDAO ignoreDAO, MailDAO mailDAO, SettingDAO settingDAO, FColorDao fColorDao) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteIgnore(FPlayer fPlayer, Ignore ignore) Deletes an ignore relationship and updates the cache.voiddeleteMail(Mail mail) Deletes a mail message from the database.getReceiverMails(FPlayer fPlayer) Gets all mail messages received by a player.getSenderMails(FPlayer fPlayer) Gets all mail messages sent by a player.voidinvalidateColors(UUID uuid) Invalidates cached color settings for a player.voidinvalidateIgnores(UUID uuid) Invalidates cached ignore relationships for a player.voidinvalidateSettings(UUID uuid) Invalidates cached settings for a player.@NonNull Map<FColor.Type, Set<FColor>> loadColors(@NonNull FPlayer fPlayer) Loads color settings for a player with cache support.loadIgnores(FPlayer fPlayer) Loads ignore relationships for a player with cache support.loadSettings(@NonNull FPlayer fPlayer) Loads all settings for a player with cache support.voidsaveColors(@NonNull FPlayer fPlayer, @NonNull Map<FColor.Type, Set<FColor>> colors) Saves color settings for a player to the database and updates the cache.saveIgnore(FPlayer fPlayer, FPlayer fTarget) Saves an ignore relationship between two players and updates the cache.Saves a mail message from one player to another.voidsaveOrUpdateSetting(@NonNull FPlayer fPlayer, @NonNull String setting, boolean value) Saves or updates a specific boolean setting for a player and updates the cache.voidsaveOrUpdateSetting(@NonNull FPlayer fPlayer, @NonNull SettingText setting, @Nullable String value) Saves or updates a specific text setting for a player and updates the cache.
-
Constructor Details
-
SocialRepository
@Inject public SocialRepository(com.google.common.cache.Cache<UUID, Map<FColor.Type, Set<FColor>>> playerColorCache, com.google.common.cache.Cache<UUID, SocialRepository.Settings> playerSettingCache, com.google.common.cache.Cache<UUID, List<Ignore>> playerIgnoreCache, IgnoreDAO ignoreDAO, MailDAO mailDAO, SettingDAO settingDAO, FColorDao fColorDao)
-
-
Method Details
-
loadIgnores
Loads ignore relationships for a player with cache support. Returns cached ignores if available, otherwise loads from database and caches the result.- Parameters:
fPlayer- the player to load ignores for- Returns:
- list of ignore relationships for the player
-
invalidateIgnores
Invalidates cached ignore relationships for a player.- Parameters:
uuid- the UUID of the player whose ignore cache should be cleared
-
saveIgnore
Saves an ignore relationship between two players and updates the cache.- Parameters:
fPlayer- the player who is ignoringfTarget- the player being ignored- Returns:
- Optional containing the created ignore record, or empty if creation failed
-
deleteIgnore
-
getReceiverMails
-
getSenderMails
-
saveMail
Saves a mail message from one player to another.- Parameters:
fPlayer- the sender of the mail messagefTarget- the recipient of the mail messagemessage- the content of the mail message- Returns:
- Optional containing the created mail record, or empty if creation failed
-
deleteMail
Deletes a mail message from the database.- Parameters:
mail- the mail record to delete
-
loadColors
Loads color settings for a player with cache support. Returns cached colors if available, otherwise loads from database and caches the result.- Parameters:
fPlayer- the player to load colors for- Returns:
- map of color types to sets of FColor objects
-
invalidateColors
Invalidates cached color settings for a player.- Parameters:
uuid- the UUID of the player whose color cache should be cleared
-
saveColors
Saves color settings for a player to the database and updates the cache.- Parameters:
fPlayer- the player whose colors are being savedcolors- map of color types to sets of FColor objects to save
-
loadSettings
Loads all settings for a player with cache support. Returns cached settings if available, otherwise loads from database and caches the result.- Parameters:
fPlayer- the player to load settings for- Returns:
- Settings object containing boolean and text settings
-
invalidateSettings
Invalidates cached settings for a player.- Parameters:
uuid- the UUID of the player whose settings cache should be cleared
-
saveOrUpdateSetting
Saves or updates a specific boolean setting for a player and updates the cache.- Parameters:
fPlayer- the player whose setting is being savedsetting- the name of the boolean settingvalue- the boolean value to set
-
saveOrUpdateSetting
public void saveOrUpdateSetting(@NonNull FPlayer fPlayer, @NonNull SettingText setting, @Nullable String value) Saves or updates a specific text setting for a player and updates the cache.- Parameters:
fPlayer- the player whose setting is being savedsetting- the SettingText enum representing the text setting typevalue- the text value to set, can be null to remove the setting
-