Class AntiSpam.Builder

java.lang.Object
dev.crafty.core.player.AntiSpam.Builder
Enclosing class:
AntiSpam

public static class AntiSpam.Builder extends Object
Builder class for configuring and sending messages with anti-spam checks.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • to

      public AntiSpam.Builder to(org.bukkit.entity.Player player)
      Sets the target player to send the message to.
      Parameters:
      player - the target player
      Returns:
      this Builder instance
    • message

      public AntiSpam.Builder message(String message)
      Sets the message to be sent.
      Parameters:
      message - the message content
      Returns:
      this Builder instance
    • cooldown

      public AntiSpam.Builder cooldown(Duration cooldown)
      Sets the cooldown duration between messages with the same key.
      Parameters:
      cooldown - the cooldown duration
      Returns:
      this Builder instance
    • key

      public AntiSpam.Builder key(String 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.