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 Details

    • invalidate

      void invalidate()
      Invalidates all cached data in the social repository. Clears player colors, settings and ignores
    • invalidate

      void invalidate(UUID uuid)
      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

      @Nullable String getSetting(@NonNull FPlayer fPlayer, @Nullable SettingText setting)
      Gets a player's setting value
      Parameters:
      fPlayer - the player to get the setting for
      setting - the setting
      Returns:
      the text setting value, or null if not set
    • getSetting

      @Nullable String getSetting(@NonNull FPlayer fPlayer, @Nullable String setting)
      Gets a player's setting value
      Parameters:
      fPlayer - the player to get the setting for
      setting - the setting
      Returns:
      the text setting value, or null if not set
    • isSetting

      boolean isSetting(@NonNull FPlayer fPlayer, @Nullable ModuleName setting)
      Checks if a player has a boolean setting enabled by name
      Parameters:
      fPlayer - the player to check
      setting - the setting
      Returns:
      true if the setting is enabled or not set, false if disabled
    • isSetting

      boolean isSetting(@NonNull FPlayer fPlayer, @Nullable String setting)
      Checks if a player has a boolean setting enabled by name
      Parameters:
      fPlayer - the player to check
      setting - the setting
      Returns:
      true if the setting is enabled or not set, false if disabled
    • saveSetting

      void saveSetting(@NonNull FPlayer fPlayer, @NonNull SettingText setting, @Nullable String value)
      Saves a player's text setting
      Parameters:
      fPlayer - the player to save the setting for
      setting - the setting
      value - the text value to set, can be null
    • saveSetting

      void saveSetting(@NonNull FPlayer fPlayer, @NonNull String setting, @Nullable String value)
      Saves a player's text setting
      Parameters:
      fPlayer - the player to save the setting for
      setting - the stored key
      value - the value, or null to remove it
    • saveSetting

      void saveSetting(@NonNull FPlayer fPlayer, @NonNull String setting, boolean value)
      Saves a boolean setting for a player
      Parameters:
      fPlayer - the player to save the setting for
      setting - the stored key
      value - the boolean value to set
    • loadSettings

      @NonNull SocialRepository.Settings loadSettings(FPlayer fPlayer)
      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

      @NonNull SocialRepository.Settings loadSettings(FPlayer fPlayer, boolean cache)
      Loads all settings for a player with optional cache control.
      Parameters:
      fPlayer - the player to load settings for
      cache - if true, use cached settings; if false, invalidate cache and reload from database
      Returns:
      Settings object containing boolean and text settings
    • loadColors

      @NonNull Map<Integer,String> 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.
      Parameters:
      fPlayer - the player to load colors for
      type - the color type to load
      Returns:
      map of color numbers to color names, empty if no colors found
    • loadColors

      @NonNull Map<FColor.Type, Set<FColor>> loadColors(FPlayer fPlayer)
      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

      @NonNull Map<FColor.Type, Set<FColor>> loadColors(FPlayer fPlayer, boolean cache)
      Loads all colors for a player with optional cache control.
      Parameters:
      fPlayer - the player to load colors for
      cache - 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 for
      type - the color type to save
      newColors - the set of new colors to save, can be null or empty to clear
    • saveColors

      void saveColors(@NonNull FPlayer fPlayer, @NonNull Map<FColor.Type, Set<FColor>> colors)
      Saves all colors for a player and notifies proxy if enabled.
      Parameters:
      fPlayer - the player to save colors for
      colors - map of color types to sets of FColor objects to save
    • isIgnored

      boolean isIgnored(@NonNull FPlayer fPlayer, @NonNull FPlayer fTarget)
      Checks if a player is ignoring another player.
      Parameters:
      fPlayer - the player who might be ignoring
      fTarget - the potential target being ignored
      Returns:
      true if fPlayer is ignoring fTarget, false otherwise
    • loadIgnores

      @NonNull List<Ignore> loadIgnores(FPlayer fPlayer)
      Loads all ignore relationships for a player with caching enabled.
      Parameters:
      fPlayer - the player to load ignores for
      Returns:
      list of ignore relationships
    • loadIgnores

      @NonNull List<Ignore> loadIgnores(FPlayer fPlayer, boolean cache)
      Loads all ignore relationships for a player with optional cache control.
      Parameters:
      fPlayer - the player to load ignores for
      cache - if true, use cached ignores; if false, invalidate cache and reload from database
      Returns:
      list of ignore relationships
    • getReceiverMails

      @NonNull List<Mail> getReceiverMails(FPlayer fPlayer)
      Gets all mail messages received by a player.
      Parameters:
      fPlayer - the player who received the mail messages
      Returns:
      list of received mail messages
    • getSenderMails

      @NonNull List<Mail> getSenderMails(FPlayer fPlayer)
      Gets all mail messages sent by a player.
      Parameters:
      fPlayer - the player who sent the mail messages
      Returns:
      list of sent mail messages
    • saveIgnore

      @NonNull Optional<Ignore> saveIgnore(@NonNull FPlayer fPlayer, @NonNull FPlayer fTarget)
      Saves an ignore relationship between two players and notifies proxy if enabled.
      Parameters:
      fPlayer - the player who is ignoring
      fTarget - 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 message
      fTarget - the recipient of the mail message
      message - the content of the mail message
      Returns:
      Optional containing the created mail record, or empty if creation failed
    • deleteIgnore

      void deleteIgnore(@NonNull FPlayer fPlayer, @NonNull Ignore ignore)
      Deletes an ignore relationship and notifies proxy if enabled.
      Parameters:
      fPlayer - the player who was ignoring
      ignore - the ignore record to delete
    • deleteMail

      void deleteMail(@NonNull Mail mail)
      Deletes a mail message from the database.
      Parameters:
      mail - the mail record to delete
    • updateLocale

      boolean updateLocale(@NonNull FPlayer fPlayer, @NonNull String newLocale)
      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 updated
      newLocale - 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

      boolean isVanished(@NonNull FEntity fEntity)
      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

      boolean canSeeVanished(@NonNull FEntity fTarget, @NonNull FEntity fViewer)
      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 null
      fViewer - 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

      boolean canSeeVanished(@NonNull FEntity fTarget, @NonNull FEntity fViewer, boolean targetVanished)
      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 null
      fViewer - the viewer entity attempting to see the target, must not be null
      targetVanished - 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