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 Summary
Modifier and TypeMethodDescriptiongetAll(@NonNull FPlayer player, Moderation.Type type, @Nullable String server, int limit, int offset) Retrieves all moderations for a player regardless of their validity status.intgetTotalCount(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.intgetTotalValidCount(FPlayer fPlayer, Moderation.Type type, @Nullable String server) Counts the total number of valid moderations for a specific player and type.intgetTotalValidCount(Moderation.Type type, @Nullable String server) Counts the total number of valid moderations by type across all players.Retrieves a single valid moderation entry by its unique identifier.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.getValid(Moderation.Type type, @Nullable String server, int limit, int offset) Retrieves valid (non-expired) moderations by type across all players with pagination.getValidNames(Moderation.Type type, @Nullable String server) Gets names of players with valid moderation's of a type.voidinvalidate(@NonNull UUID playerId, Moderation.Type type, @Nullable String server) Invalidates cache for a specific player and moderation type.voidInvalidates all moderation cache.voidinvalidateAll(@NonNull UUID playerId) Invalidates cache for all moderation types for a player.save(@NonNull FPlayer fTarget, long date, long time, String reason, int moderatorID, Moderation.Type type, String server) Saves a new moderation.voidupdateValid(int id, @Nullable String server) Invalidates a specific moderation entry by setting its valid flag to false.voidupdateValid(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.
-
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 fortype- the moderation type to filter byserver- the server ID (can be null for global search)limit- maximum number of results to returnoffset- 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 fortype- the moderation type to filter byserver- the server ID (can be null for global search)limit- maximum number of results to returnoffset- number of results to skip for pagination- Returns:
- list of all moderation actions matching the criteria
-
invalidate
Invalidates cache for a specific player and moderation type.- Parameters:
playerId- the player UUIDtype- the moderation type
-
invalidateAll
void invalidateAll()Invalidates all moderation cache. -
invalidateAll
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 playerdate- the moderation datetime- the expiration timestamp (-1 for permanent)reason- the moderation reasonmoderatorID- the moderator IDtype- the moderation typeserver- the server ID- Returns:
- the created moderation
-
getValid
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 byserver- the server ID (can be null for global search)limit- maximum number of results to returnoffset- number of results to skip for pagination- Returns:
- list of valid moderation actions matching the criteria
-
getValid
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
Gets names of players with valid moderation's of a type.- Parameters:
type- the moderation typeserver- the server ID- Returns:
- list of player names
-
getTotalCount
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 fortype- the moderation type to filter byserver- the server ID (can be null for global count)- Returns:
- the total count of moderation records matching the criteria
-
getTotalValidCount
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 fortype- the moderation type to filter byserver- the server ID (can be null for global count)- Returns:
- the count of valid moderations matching the criteria
-
getTotalValidCount
Counts the total number of valid moderations by type across all players. Only includes non-expired moderations.- Parameters:
type- the moderation type to filter byserver- the server ID (can be null for global count)- Returns:
- the count of valid moderations matching the criteria
-
updateValid
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 invalidateserver- the server ID (can be null for global invalidation)
-
updateValid
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 IDtype- the moderation type to invalidateserver- the server ID (can be null for global invalidation)
-