Interface PunishmentUser
- All Known Implementing Classes:
PunishmentUserProvider
Represents a user who has been punished or is subject to a punishment.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexists(int userId, int typeId) Checks if a record or punishment exists for a specific type and user.getCreatedAt(int userId, int typeId) Retrieves the timestamp representing when the entity associated with the specified type and user was created.intgetCreatedBy(int userId, int typeId) Retrieves the identifier of the user who created a punishment record.longgetDuration(int userId, int typeId) Retrieves the duration of a punishment for a specified type and user.getExpiredDate(int userId, int typeId) Retrieves the expiration date of a punishment for a specific user and type.longgetExpiredTime(int userId, int typeId) Retrieves the expiration time of a punishment for a specific user and type.getLogId(int userId, int typeId) Retrieves the log identifier related to a specific type and user.getModifiedAt(int userId, int typeId) Retrieves the timestamp of the last modification made to the punishment details of a user specified by their type ID and user ID.intgetModifiedBy(int userId, int typeId) Retrieves the ID of the user who last modified the punishment record.getReason(int userId, int typeId) Retrieves the reason associated with a specified type and user by their respective IDs.intgetReasonId(int userId, int typeId) Retrieves the reason ID associated with the specified type and user ID.getUsers(int typeId) Retrieves a list of user IDs associated with the specified punishment type.booleanisPunished(int userId, int typeId) Determines whether the specified user is currently punished for the given type.voidpunish(int userId, int typeId, int executorId, InetAddress inetAddress, int reasonId) Applies a punishment to a user.voidsetExpiredTime(int userId, int typeId, int executorId, long time) Sets the expiration time for a punishment record.voidsetReasonId(int userId, int typeId, int executorId, int reasonId) Updates the reason associated with the punishment of a user.voidunpunished(int userId, int typeId) Removes the punishment for the specified user and type.
-
Method Details
-
exists
boolean exists(int userId, int typeId) Checks if a record or punishment exists for a specific type and user.- Parameters:
userId- The ID of the user to check for the existence of the record.typeId- The ID of the punishment type to check.- Returns:
- true if the record exists, false otherwise.
-
punish
Applies a punishment to a user.- Parameters:
userId- The ID of the user being punishedtypeId- The ID representing the type of punishmentexecutorId- The ID of the executor performing the punishmentinetAddress- The network address associated with the userreasonId- The ID representing the reason for the punishment
-
unpunished
void unpunished(int userId, int typeId) Removes the punishment for the specified user and type.- Parameters:
userId- The identifier of the usertypeId- The identifier of the punishment type
-
getUsers
Retrieves a list of user IDs associated with the specified punishment type.- Parameters:
typeId- The ID of the punishment type- Returns:
- A list of user IDs associated with the specified punishment type
-
getLogId
Retrieves the log identifier related to a specific type and user.- Parameters:
userId- The unique identifier of the user.typeId- The type identifier associated with the user.- Returns:
- The UUID representing the log identifier for the given type and user.
-
getReasonId
int getReasonId(int userId, int typeId) Retrieves the reason ID associated with the specified type and user ID.- Parameters:
userId- The ID of the user for whom the reason ID is requested.typeId- The ID representing the type of punishment.- Returns:
- The reason ID associated with the given type and user ID.
-
setReasonId
void setReasonId(int userId, int typeId, int executorId, int reasonId) Updates the reason associated with the punishment of a user.- Parameters:
userId- The identifier of the user being punished.typeId- The type identifier of the punishment.executorId- The identifier of the executor making the change.reasonId- The identifier of the new reason for the punishment.
-
getReason
Retrieves the reason associated with a specified type and user by their respective IDs.- Parameters:
userId- The ID representing the user associated with the punishment or actiontypeId- The ID representing the type of the punishment or action- Returns:
- The reason as a string for the specified type and user
-
getDuration
long getDuration(int userId, int typeId) Retrieves the duration of a punishment for a specified type and user.- Parameters:
userId- The ID of the user whose punishment duration is to be retrieved.typeId- The ID representing the type of punishment.- Returns:
- The duration of the punishment in milliseconds.
-
getExpiredTime
long getExpiredTime(int userId, int typeId) Retrieves the expiration time of a punishment for a specific user and type.- Parameters:
userId- The ID of the user associated with the punishment.typeId- The ID of the punishment type.- Returns:
- The expiration time of the punishment as a timestamp in milliseconds.
-
getExpiredDate
Retrieves the expiration date of a punishment for a specific user and type.- Parameters:
userId- The unique identifier of the usertypeId- The unique identifier of the punishment type- Returns:
- A string representing the expiration date of the punishment, or null if no expiration date is set
-
setExpiredTime
void setExpiredTime(int userId, int typeId, int executorId, long time) Sets the expiration time for a punishment record.- Parameters:
userId- The identifier of the user being punishedtypeId- The type of punishment being setexecutorId- The identifier of the executor making the changetime- The expiration time of the punishment, in milliseconds since epoch
-
isPunished
boolean isPunished(int userId, int typeId) Determines whether the specified user is currently punished for the given type.- Parameters:
userId- The identifier of the usertypeId- The identifier of the punishment type- Returns:
- true if the user is currently punished for the specified type, false otherwise
-
getCreatedBy
int getCreatedBy(int userId, int typeId) Retrieves the identifier of the user who created a punishment record.- Parameters:
userId- The ID of the affected user.typeId- The ID of the punishment type.- Returns:
- The ID of the user who created the punishment.
-
getCreatedAt
Retrieves the timestamp representing when the entity associated with the specified type and user was created.- Parameters:
userId- The ID of the user associated with the creationtypeId- The ID of the type associated with the creation- Returns:
- The creation timestamp of the associated type and user
-
getModifiedBy
int getModifiedBy(int userId, int typeId) Retrieves the ID of the user who last modified the punishment record.- Parameters:
userId- The user identifier related to the punishment recordtypeId- The type identifier associated with the punishment record- Returns:
- The ID of the user who last modified the punishment record
-
getModifiedAt
Retrieves the timestamp of the last modification made to the punishment details of a user specified by their type ID and user ID.- Parameters:
userId- The unique identifier for the usertypeId- The unique identifier for the punishment type- Returns:
- A
Timestamprepresenting the last modification time for the specified type and user
-