Package dev.crafty.core.player
Class AntiSpam.Builder
java.lang.Object
dev.crafty.core.player.AntiSpam.Builder
- Enclosing class:
AntiSpam
Builder class for configuring and sending messages with anti-spam checks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the cooldown duration between messages with the same key.Sets the key used to identify the type of message for cooldown tracking.Sets the message to be sent.void
send()
Sends the message to the player if the cooldown has expired for the given key.to
(org.bukkit.entity.Player player) Sets the target player to send the message to.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
to
Sets the target player to send the message to.- Parameters:
player
- the target player- Returns:
- this Builder instance
-
message
Sets the message to be sent.- Parameters:
message
- the message content- Returns:
- this Builder instance
-
cooldown
Sets the cooldown duration between messages with the same key.- Parameters:
cooldown
- the cooldown duration- Returns:
- this Builder instance
-
key
Sets the key used to identify the type of message for cooldown tracking.- Parameters:
key
- the message key- Returns:
- this Builder instance
-
send
public void send()Sends the message to the player if the cooldown has expired for the given key. If the cooldown has not expired, the message is not sent.
-