Class RepetitionCheck
java.lang.Object
studio.thevipershow.safechat.api.checks.ChatCheck
studio.thevipershow.safechat.chat.check.types.RepetitionCheck
- All Implemented Interfaces:
Check
public final class RepetitionCheck extends ChatCheck
-
Field Summary
Fields inherited from class studio.thevipershow.safechat.api.checks.ChatCheck
DOMAIN_REGEX, IPV4_REGEX, PLAYER_PLACEHOLDER, PREFIX_PLACEHOLDER, SPLIT_SPACE
-
Constructor Summary
Constructors Constructor Description RepetitionCheck(@NotNull CheckConfig checkConfig, @NotNull MessagesConfig messagesConfig)
-
Method Summary
Modifier and Type Method Description boolean
check(@NotNull ChatData data)
Perform a check on ChatData.boolean
getLoggingEnabled()
Gets the status of logging for this check from the config@NotNull java.lang.String
getPunishmentCommand()
Get the command to execute when a punishment is required.long
getPunishmentRequiredValue()
Get after how often should a player trigger a punish.@NotNull java.util.List<java.lang.String>
getWarningMessages()
Get the warning messages that will be displayed when the player fails a check.boolean
hasWarningEnabled()
Get the warning messages status.@NotNull java.lang.String
replacePlaceholders(@NotNull java.lang.String message, @NotNull ChatData data)
Provide placeholders for your own check.Methods inherited from class studio.thevipershow.safechat.api.checks.ChatCheck
getBypassPermission, getCheckPriority, getName
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
RepetitionCheck
public RepetitionCheck(@NotNull @NotNull CheckConfig checkConfig, @NotNull @NotNull MessagesConfig messagesConfig)
-
-
Method Details
-
check
Perform a check on ChatData. The check can consist in anything, but it must follow these criteria: The check must return true if the player failed the check. The check must return false if the player passed the check.- Parameters:
data
- The chat data.- Returns:
- True if failed, false otherwise.
-
hasWarningEnabled
public boolean hasWarningEnabled()Get the warning messages status.- Returns:
- True if a warning message should be sent upon the player failing a check.
-
getWarningMessages
@NotNull public @NotNull java.util.List<java.lang.String> getWarningMessages()Get the warning messages that will be displayed when the player fails a check.- Returns:
- The warning messages.
-
replacePlaceholders
@NotNull public @NotNull java.lang.String replacePlaceholders(@NotNull @NotNull java.lang.String message, @NotNull @NotNull ChatData data)Provide placeholders for your own check. Replace any placeholder with your data.- Parameters:
message
- The message that may contain placeholders.data
- The data (used for placeholders).- Returns:
- The message, modified if it had placeholders support.
-
getPunishmentRequiredValue
public long getPunishmentRequiredValue()Get after how often should a player trigger a punish. For example 2 will mean each 2 failed checks, will trigger the punishment.- Returns:
- The interval value.
-
getPunishmentCommand
@NotNull public @NotNull java.lang.String getPunishmentCommand()Get the command to execute when a punishment is required. Placeholders may be used.- Returns:
- The command to execute.
-
getLoggingEnabled
public boolean getLoggingEnabled()Gets the status of logging for this check from the config- Returns:
- if logging is enabled for this check
-