Interface ModerationSQL
- All Superinterfaces:
SQL
SQL interface for moderation data operations in FlectonePulse.
Defines database queries for managing player moderation's.
- Since:
- 0.9.0
-
Method Summary
Modifier and TypeMethodDescriptionfindValidById(long currentTime, String server, int id) Finds a single valid moderation entry by its unique identifier.findValidByPlayerAndType(int playerId, String type, long currentTime, String server, int limit, int offset) Finds valid (non-expired) moderations for a specific player and type with pagination support.findValidByType(String type, long currentTime, String server, int limit, int offset) Finds valid (non-expired) moderations by type across all players with pagination support.findValidPlayerNamesByType(String type, long currentTime, String server) Finds player names with valid moderation's by type.intgetTotalValidCountByPlayerAndType(int playerId, String type, long currentTime, String server) Counts the total number of valid moderations for a specific player and type.intgetTotalValidCountByType(String type, long currentTime, String server) Counts the total number of valid moderations by type across all players.intinsert(int playerId, long date, long time, String reason, int moderatorId, String type, String server) Inserts a new moderation.voidinvalidate(int id, String server) Invalidates a specific moderation entry by its ID.voidinvalidate(int playerId, String type, String server) Invalidates all moderations of a specific type for player.
-
Method Details
-
findValidByPlayerAndType
List<Moderation> findValidByPlayerAndType(int playerId, String type, long currentTime, String server, int limit, int offset) Finds valid (non-expired) moderations for a specific player and type with pagination support. Results are ordered by ID in descending order.- Parameters:
playerId- the player ID to search moderations fortype- the moderation type to filter bycurrentTime- the current timestamp used to check expiration statusserver- 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 moderations matching the criteria
-
findValidByType
List<Moderation> findValidByType(String type, long currentTime, String server, int limit, int offset) Finds valid (non-expired) moderations by type across all players with pagination support. Results are ordered by ID in descending order.- Parameters:
type- the moderation type to filter bycurrentTime- the current timestamp used to check expiration statusserver- 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 moderations matching the criteria
-
findValidById
Finds a single valid moderation entry by its unique identifier. Checks that the moderation is valid and not expired, optionally filtered by server.- Parameters:
currentTime- the current timestamp used to check expiration statusserver- 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
-
findValidPlayerNamesByType
-
getTotalValidCountByPlayerAndType
Counts the total number of valid moderations for a specific player and type. Only includes non-expired moderations and can be filtered by server.- Parameters:
playerId- the player ID to count moderations fortype- the moderation type to filter bycurrentTime- the current timestamp used to check expiration statusserver- the server ID (can be null for global count)- Returns:
- the count of valid moderations matching the criteria
-
getTotalValidCountByType
Counts the total number of valid moderations by type across all players. Only includes non-expired moderations and can be filtered by server.- Parameters:
type- the moderation type to filter bycurrentTime- the current timestamp used to check expiration statusserver- the server ID (can be null for global count)- Returns:
- the count of valid moderations matching the criteria
-
insert
int insert(int playerId, long date, long time, String reason, int moderatorId, String type, String server) Inserts a new moderation.- Parameters:
playerId- the player IDdate- the timestamp when the moderation was appliedtime- the expiration timestamp (-1 for permanent)reason- the moderation reasonmoderatorId- the ID of the moderatortype- the moderation typeserver- the server ID- Returns:
- the generated moderation ID
-
invalidate
Invalidates a specific moderation entry by its ID. Sets the valid flag to false, effectively removing it from active moderation lists.- Parameters:
id- the unique moderation entry identifierserver- the server ID (can be null for global invalidation)
-
invalidate
Invalidates all moderations of a specific type for player. Sets the valid flag to false for all matching entries, optionally filtered by server.- Parameters:
playerId- the player IDtype- the moderation type to invalidateserver- the server ID (can be null for global invalidation)
-