Interface ModerationRepository


public interface ModerationRepository
Repository for managing moderation data in FlectonePulse. Provides caching and retrieval of player moderation's.
Since:
0.8.1
  • Method Details

    • getValid

      List<Moderation> getValid(@NonNull FPlayer player, Moderation.Type type, @Nullable String server, int limit, int offset)
      Retrieves valid (non-expired) moderations for a player with caching support. Checks cache consistency across servers and refreshes if server mismatch is detected. Only returns active moderations and updates cache accordingly.
      Parameters:
      player - the player to retrieve moderations for
      type - the moderation type to filter by
      server - the server ID (can be null for global search)
      limit - maximum number of results to return
      offset - number of results to skip for pagination
      Returns:
      list of valid moderation actions, or empty list if an error occurs
    • getAll

      List<Moderation> getAll(@NonNull FPlayer player, Moderation.Type type, @Nullable String server, int limit, int offset)
      Retrieves all moderations for a player regardless of their validity status. Includes both active and expired/invalidated moderation entries.
      Parameters:
      player - the player to retrieve moderations for
      type - the moderation type to filter by
      server - the server ID (can be null for global search)
      limit - maximum number of results to return
      offset - number of results to skip for pagination
      Returns:
      list of all moderation actions matching the criteria
    • invalidate

      void invalidate(@NonNull UUID playerId, Moderation.Type type, @Nullable String server)
      Invalidates cache for a specific player and moderation type.
      Parameters:
      playerId - the player UUID
      type - the moderation type
    • invalidateAll

      void invalidateAll()
      Invalidates all moderation cache.
    • invalidateAll

      void invalidateAll(@NonNull UUID playerId)
      Invalidates cache for all moderation types for a player.
      Parameters:
      playerId - the player UUID
    • save

      Moderation save(@NonNull FPlayer fTarget, long date, long time, String reason, int moderatorID, Moderation.Type type, String server)
      Saves a new moderation.
      Parameters:
      fTarget - the target player
      date - the moderation date
      time - the expiration timestamp (-1 for permanent)
      reason - the moderation reason
      moderatorID - the moderator ID
      type - the moderation type
      server - the server ID
      Returns:
      the created moderation
    • getValid

      List<Moderation> getValid(Moderation.Type type, @Nullable String server, int limit, int offset)
      Retrieves valid (non-expired) moderations by type across all players with pagination. This method does not use caching and queries the database directly.
      Parameters:
      type - the moderation type to filter by
      server - the server ID (can be null for global search)
      limit - maximum number of results to return
      offset - number of results to skip for pagination
      Returns:
      list of valid moderation actions matching the criteria
    • getValid

      Optional<Moderation> getValid(@Nullable String server, int id)
      Retrieves a single valid moderation entry by its unique identifier. Checks that the moderation is valid and not expired.
      Parameters:
      server - the server ID (can be null for global search)
      id - the unique moderation entry identifier
      Returns:
      an Optional containing the moderation if found and valid, or empty otherwise
    • getValidNames

      List<String> getValidNames(Moderation.Type type, @Nullable String server)
      Gets names of players with valid moderation's of a type.
      Parameters:
      type - the moderation type
      server - the server ID
      Returns:
      list of player names
    • getTotalCount

      int getTotalCount(FPlayer fPlayer, Moderation.Type type, @Nullable String server)
      Counts the total number of moderation records for a specific player and type, regardless of their validity status.
      Parameters:
      fPlayer - the player to count moderations for
      type - the moderation type to filter by
      server - the server ID (can be null for global count)
      Returns:
      the total count of moderation records matching the criteria
    • getTotalValidCount

      int getTotalValidCount(FPlayer fPlayer, Moderation.Type type, @Nullable String server)
      Counts the total number of valid moderations for a specific player and type. Only includes non-expired moderations.
      Parameters:
      fPlayer - the player to count moderations for
      type - the moderation type to filter by
      server - the server ID (can be null for global count)
      Returns:
      the count of valid moderations matching the criteria
    • getTotalValidCount

      int getTotalValidCount(Moderation.Type type, @Nullable String server)
      Counts the total number of valid moderations by type across all players. Only includes non-expired moderations.
      Parameters:
      type - the moderation type to filter by
      server - the server ID (can be null for global count)
      Returns:
      the count of valid moderations matching the criteria
    • updateValid

      void updateValid(int id, @Nullable String server)
      Invalidates a specific moderation entry by setting its valid flag to false. This effectively removes it from active moderation lists without deleting the record.
      Parameters:
      id - the unique moderation entry identifier to invalidate
      server - the server ID (can be null for global invalidation)
    • updateValid

      void updateValid(int playerId, @NonNull Moderation.Type type, @Nullable String server)
      Invalidates all player moderation entries of a specific type by setting their valid flag to false. Can be filtered by server to target server-specific moderations only.
      Parameters:
      playerId - the player ID
      type - the moderation type to invalidate
      server - the server ID (can be null for global invalidation)