Interface SocialService
public interface SocialService
Service for managing social interactions and player settings in FlectonePulse.
Handles player preferences including settings, colors, ignore lists, and mail messages.
Integrates with proxy systems to synchronize social data across servers.
- Since:
- 1.10.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanSeeVanished(@NonNull FEntity fTarget, @NonNull FEntity fViewer) Determines whether a viewer can see a target entity that may be in vanish mode.booleancanSeeVanished(@NonNull FEntity fTarget, @NonNull FEntity fViewer, boolean targetVanished) Determines whether a viewer can see a target entity with a known vanish status.voiddeleteIgnore(@NonNull FPlayer fPlayer, @NonNull Ignore ignore) Deletes an ignore relationship and notifies proxy if enabled.voiddeleteMail(@NonNull 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.@Nullable StringgetSetting(@NonNull FPlayer fPlayer, @Nullable String setting) Gets a player's setting value@Nullable StringgetSetting(@NonNull FPlayer fPlayer, @Nullable SettingText setting) Gets a player's setting valuebooleanChecks whether any vanish integrations are currently registered and active.voidInvalidates all cached data in the social repository.voidinvalidate(UUID uuid) Invalidates all cached social data for a player including colors, settings, and ignores.booleanChecks if a player is ignoring another player.booleanChecks if a player has a boolean setting enabled by namebooleanisSetting(@NonNull FPlayer fPlayer, @Nullable ModuleName setting) Checks if a player has a boolean setting enabled by namebooleanisVanished(@NonNull FEntity fEntity) Checks whether a given entity is currently in vanish mode (invisible to other players).loadColors(@NonNull FPlayer fPlayer, @NonNull FColor.Type type) Loads colors of a specific type for a player and converts them to a number-to-name map.@NonNull Map<FColor.Type, Set<FColor>> loadColors(FPlayer fPlayer) Loads all colors for a player with caching enabled.@NonNull Map<FColor.Type, Set<FColor>> loadColors(FPlayer fPlayer, boolean cache) Loads all colors for a player with optional cache control.loadIgnores(FPlayer fPlayer) Loads all ignore relationships for a player with caching enabled.loadIgnores(FPlayer fPlayer, boolean cache) Loads all ignore relationships for a player with optional cache control.@NonNull SocialRepository.SettingsloadSettings(FPlayer fPlayer) Loads all settings for a player with caching enabled.@NonNull SocialRepository.SettingsloadSettings(FPlayer fPlayer, boolean cache) Loads all settings for a player with optional cache control.voidsaveColors(@NonNull FPlayer fPlayer, @NonNull Map<FColor.Type, Set<FColor>> colors) Saves all colors for a player and notifies proxy if enabled.voidsaveColors(@NonNull FPlayer fPlayer, @NonNull FColor.Type type, @Nullable Set<FColor> newColors) Saves colors of a specific type for a player, merging with existing colors.saveIgnore(@NonNull FPlayer fPlayer, @NonNull FPlayer fTarget) Saves an ignore relationship between two players and notifies proxy if enabled.Saves a mail message from one player to another.voidsaveSetting(@NonNull FPlayer fPlayer, @NonNull String setting, boolean value) Saves a boolean setting for a playervoidsaveSetting(@NonNull FPlayer fPlayer, @NonNull String setting, @Nullable String value) Saves a player's text settingvoidsaveSetting(@NonNull FPlayer fPlayer, @NonNull SettingText setting, @Nullable String value) Saves a player's text settingbooleanupdateLocale(@NonNull FPlayer fPlayer, @NonNull String newLocale) Updates a player's locale setting based on Triton integration or provided value.
-
Method Details
-
invalidate
void invalidate()Invalidates all cached data in the social repository. Clears player colors, settings and ignores -
invalidate
Invalidates all cached social data for a player including colors, settings, and ignores.- Parameters:
uuid- the UUID of the player whose social data cache should be cleared
-
getSetting
Gets a player's setting value- Parameters:
fPlayer- the player to get the setting forsetting- the setting- Returns:
- the text setting value, or null if not set
-
getSetting
-
isSetting
Checks if a player has a boolean setting enabled by name- Parameters:
fPlayer- the player to checksetting- the setting- Returns:
- true if the setting is enabled or not set, false if disabled
-
isSetting
-
saveSetting
Saves a player's text setting- Parameters:
fPlayer- the player to save the setting forsetting- the settingvalue- the text value to set, can be null
-
saveSetting
-
saveSetting
-
loadSettings
Loads all settings for a player with caching enabled.- Parameters:
fPlayer- the player to load settings for- Returns:
- Settings object containing boolean and text settings
-
loadSettings
Loads all settings for a player with optional cache control.- Parameters:
fPlayer- the player to load settings forcache- if true, use cached settings; if false, invalidate cache and reload from database- Returns:
- Settings object containing boolean and text settings
-
loadColors
Loads colors of a specific type for a player and converts them to a number-to-name map.- Parameters:
fPlayer- the player to load colors fortype- the color type to load- Returns:
- map of color numbers to color names, empty if no colors found
-
loadColors
Loads all colors for a player with caching enabled.- Parameters:
fPlayer- the player to load colors for- Returns:
- map of color types to sets of FColor objects
-
loadColors
Loads all colors for a player with optional cache control.- Parameters:
fPlayer- the player to load colors forcache- if true, use cached colors; if false, invalidate cache and reload from database- Returns:
- map of color types to sets of FColor objects
-
saveColors
void saveColors(@NonNull FPlayer fPlayer, @NonNull FColor.Type type, @Nullable Set<FColor> newColors) Saves colors of a specific type for a player, merging with existing colors.- Parameters:
fPlayer- the player to save colors fortype- the color type to savenewColors- the set of new colors to save, can be null or empty to clear
-
saveColors
Saves all colors for a player and notifies proxy if enabled.- Parameters:
fPlayer- the player to save colors forcolors- map of color types to sets of FColor objects to save
-
isIgnored
-
loadIgnores
-
loadIgnores
Loads all ignore relationships for a player with optional cache control.- Parameters:
fPlayer- the player to load ignores forcache- if true, use cached ignores; if false, invalidate cache and reload from database- Returns:
- list of ignore relationships
-
getReceiverMails
-
getSenderMails
-
saveIgnore
Saves an ignore relationship between two players and notifies proxy if enabled.- Parameters:
fPlayer- the player who is ignoringfTarget- the player being ignored- Returns:
- Optional containing the created ignore record, or empty if creation failed
-
saveMail
@NonNull Optional<Mail> saveMail(@NonNull FPlayer fPlayer, @NonNull FPlayer fTarget, @NonNull String message) 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
-
deleteIgnore
-
deleteMail
Deletes a mail message from the database.- Parameters:
mail- the mail record to delete
-
updateLocale
Updates a player's locale setting based on Triton integration or provided value. Only updates if the locale has changed and the player is not unknown.- Parameters:
fPlayer- the player whose locale is being updatednewLocale- the new locale to set if Triton locale is unavailable- Returns:
- true if the locale was updated, false if unchanged or player is unknown
-
hasVanishIntegration
boolean hasVanishIntegration()Checks whether any vanish integrations are currently registered and active. Used to determine if vanish functionality should be enabled.- Returns:
- true if vanish integrations exist, false otherwise
-
isVanished
Checks whether a given entity is currently in vanish mode (invisible to other players).This method first checks if the entity is a player with a configured vanish status setting. If not found locally, it delegates to the integration module to check external vanish providers.
- Parameters:
fEntity- the entity to check for vanish status- Returns:
- true if the entity is vanished, false otherwise
-
canSeeVanished
Determines whether a viewer can see a target entity that may be in vanish mode.This is a convenience overload that automatically checks if the target is vanished.
- Parameters:
fTarget- the target entity that might be vanished, must not be nullfViewer- the viewer entity attempting to see the target, must not be null- Returns:
- true if the viewer can see the target, false if the target is vanished and the viewer lacks permission
-
canSeeVanished
Determines whether a viewer can see a target entity with a known vanish status.The following rules apply:
- An entity can always see itself
- Console entities can always see vanished players
- If the target is not vanished, any viewer can see them
- If the target is vanished, only viewers with the appropriate permission can see them
- Parameters:
fTarget- the target entity that might be vanished, must not be nullfViewer- the viewer entity attempting to see the target, must not be nulltargetVanished- pre-computed vanish status of the target entity- Returns:
- true if the viewer can see the target, false if the target is vanished and the viewer lacks permission
-