Class PunishmentReasonProvider
java.lang.Object
de.murmelmeister.murmelapi.punishment.reason.PunishmentReasonProvider
- All Implemented Interfaces:
PunishmentReason
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int reasonId, int typeId, int executorId, String reason, long duration, boolean autoFlagIp, boolean autoPunish) Adds a new punishment reason with the specified details.booleanexists(int reasonId, int typeId) Checks whether a punishment reason exists for the given reason ID and type ID.booleangetAutoFlagIP(int reasonId, int typeId) Retrieves the auto-flag IP status for a specific punishment reason and type.booleangetAutoPunish(int reasonId, int typeId) Retrieves the automatic punishment status for a specific punishment reason and type.getCreatedAt(int reasonId, int typeId) Retrieves the timestamp indicating when a specific punishment reason was created.intgetCreatedBy(int reasonId, int typeId) Retrieves the ID of the user who created the punishment reason.longgetDuration(int reasonId, int typeId) Retrieves the duration for the specified punishment reason and type.getModifiedAt(int reasonId, int typeId) Retrieves the timestamp of the last modification for a specific punishment reason.intgetModifiedBy(int reasonId, int typeId) Retrieves the user ID of the person who last modified a specific punishment reason.getReason(int reasonId, int typeId) Retrieves the reason for a specific punishment based on its reason ID and type ID.getReasons(int typeId) Retrieves a list of reason IDs associated with the specified type ID.voidremove(int reasonId, int typeId) Removes a punishment reason from the system based on the given reason ID and type ID.voidsetAutoFlagIP(int reasonId, int typeId, int executorId, boolean autoFlagIp) Updates the auto-flagging of an IP address for the given punishment reason and type.voidsetAutoPunish(int reasonId, int typeId, int executorId, boolean autoPunish) Configures the auto-punishment flag for a specific punishment reason and type.voidsetDuration(int reasonId, int typeId, int executorId, long duration) Sets the duration of a punishment reason.voidUpdates the punishment reason for the specified reason ID and type ID.static void
-
Constructor Details
-
PunishmentReasonProvider
-
-
Method Details
-
setup
-
exists
public boolean exists(int reasonId, int typeId) Description copied from interface:PunishmentReasonChecks whether a punishment reason exists for the given reason ID and type ID.- Specified by:
existsin interfacePunishmentReason- Parameters:
reasonId- The unique identifier for the reasontypeId- The unique identifier for the type- Returns:
- true if the punishment reason exists, false otherwise
-
add
public void add(int reasonId, int typeId, int executorId, String reason, long duration, boolean autoFlagIp, boolean autoPunish) Description copied from interface:PunishmentReasonAdds a new punishment reason with the specified details.- Specified by:
addin interfacePunishmentReason- Parameters:
reasonId- The unique identifier for the punishment reason.typeId- The identifier for the type of punishment.executorId- The identifier of the executor who created the punishment reason.reason- The description or explanation of the punishment reason.duration- The duration of the punishment in milliseconds; use -1 for indefinite duration.autoFlagIp- Whether the system should automatically flag the IP associated with the punishment.autoPunish- Whether the system should automatically enforce the punishment.
-
remove
public void remove(int reasonId, int typeId) Description copied from interface:PunishmentReasonRemoves a punishment reason from the system based on the given reason ID and type ID.- Specified by:
removein interfacePunishmentReason- Parameters:
reasonId- The ID of the punishment reason to be removedtypeId- The ID of the type associated with the punishment reason
-
getReasons
Description copied from interface:PunishmentReasonRetrieves a list of reason IDs associated with the specified type ID.- Specified by:
getReasonsin interfacePunishmentReason- Parameters:
typeId- The ID of the punishment type for which reason IDs should be retrieved- Returns:
- A list of integer reason IDs associated with the specified type ID
-
getReason
Description copied from interface:PunishmentReasonRetrieves the reason for a specific punishment based on its reason ID and type ID.- Specified by:
getReasonin interfacePunishmentReason- Parameters:
reasonId- The unique identifier for the reason.typeId- The unique identifier for the type of punishment.- Returns:
- The reason as a string if it exists, or null if no reason is found.
-
setReason
Description copied from interface:PunishmentReasonUpdates the punishment reason for the specified reason ID and type ID.- Specified by:
setReasonin interfacePunishmentReason- Parameters:
reasonId- The unique identifier for the punishment reason.typeId- The type identifier associated with the punishment reason.executorId- The unique identifier of the user who is executing the update.reason- The new reason to be set for the punishment.
-
getDuration
public long getDuration(int reasonId, int typeId) Description copied from interface:PunishmentReasonRetrieves the duration for the specified punishment reason and type.- Specified by:
getDurationin interfacePunishmentReason- Parameters:
reasonId- The unique identifier for the punishment reasontypeId- The unique identifier for the punishment type- Returns:
- The duration associated with the specified punishment reason and type, or -1 if not found
-
setDuration
public void setDuration(int reasonId, int typeId, int executorId, long duration) Description copied from interface:PunishmentReasonSets the duration of a punishment reason.- Specified by:
setDurationin interfacePunishmentReason- Parameters:
reasonId- The unique identifier for the punishment reason.typeId- The type identifier associated with the punishment reason.executorId- The unique identifier of the executor who modifies the duration.duration- The new duration value to be set for the punishment reason.
-
getAutoFlagIP
public boolean getAutoFlagIP(int reasonId, int typeId) Description copied from interface:PunishmentReasonRetrieves the auto-flag IP status for a specific punishment reason and type.- Specified by:
getAutoFlagIPin interfacePunishmentReason- Parameters:
reasonId- The unique ID of the punishment reasontypeId- The type ID associated with the punishment reason- Returns:
- true if the auto-flag IP feature is enabled for the specified reason and type, false otherwise
-
setAutoFlagIP
public void setAutoFlagIP(int reasonId, int typeId, int executorId, boolean autoFlagIp) Description copied from interface:PunishmentReasonUpdates the auto-flagging of an IP address for the given punishment reason and type.- Specified by:
setAutoFlagIPin interfacePunishmentReason- Parameters:
reasonId- The ID of the punishment reason to updatetypeId- The type ID associated with the punishment reasonexecutorId- The ID of the executor performing the updateautoFlagIp- A boolean indicating whether to enable or disable auto-flagging of the IP
-
getAutoPunish
public boolean getAutoPunish(int reasonId, int typeId) Description copied from interface:PunishmentReasonRetrieves the automatic punishment status for a specific punishment reason and type.- Specified by:
getAutoPunishin interfacePunishmentReason- Parameters:
reasonId- The unique identifier of the punishment reasontypeId- The unique identifier of the punishment type- Returns:
- true if automatic punishment is enabled for the given reason and type, false otherwise
-
setAutoPunish
public void setAutoPunish(int reasonId, int typeId, int executorId, boolean autoPunish) Description copied from interface:PunishmentReasonConfigures the auto-punishment flag for a specific punishment reason and type.- Specified by:
setAutoPunishin interfacePunishmentReason- Parameters:
reasonId- The unique identifier for the punishment reason.typeId- The unique identifier for the punishment type.executorId- The unique identifier for the executor who is making the change.autoPunish- A boolean value indicating whether auto-punishment should be enabled (true) or disabled (false).
-
getCreatedBy
public int getCreatedBy(int reasonId, int typeId) Description copied from interface:PunishmentReasonRetrieves the ID of the user who created the punishment reason.- Specified by:
getCreatedByin interfacePunishmentReason- Parameters:
reasonId- The ID of the punishment reasontypeId- The ID of the punishment type- Returns:
- The ID of the user who created the punishment reason, or a default value if not found
-
getCreatedAt
Description copied from interface:PunishmentReasonRetrieves the timestamp indicating when a specific punishment reason was created.- Specified by:
getCreatedAtin interfacePunishmentReason- Parameters:
reasonId- The unique identifier of the punishment reason.typeId- The unique identifier of the punishment type.- Returns:
- The timestamp representing the creation time of the punishment reason,
or
nullif the reason does not exist.
-
getModifiedBy
public int getModifiedBy(int reasonId, int typeId) Description copied from interface:PunishmentReasonRetrieves the user ID of the person who last modified a specific punishment reason.- Specified by:
getModifiedByin interfacePunishmentReason- Parameters:
reasonId- The unique identifier for the punishment reason.typeId- The unique identifier for the punishment type.- Returns:
- The user ID of the person who last modified the specified punishment reason, or -2 if not found.
-
getModifiedAt
Description copied from interface:PunishmentReasonRetrieves the timestamp of the last modification for a specific punishment reason.- Specified by:
getModifiedAtin interfacePunishmentReason- Parameters:
reasonId- The ID of the punishment reasontypeId- The ID of the punishment type- Returns:
- The timestamp representing when the punishment reason was last modified
-