java.lang.Object
com.winterhavenmc.library.messagebuilder.models.keys.CooldownKey

public final class CooldownKey extends Object
An implementation of a string for use in the cooldown map. It is composed of the recipient uuid and the unique MessageId. If a recipient does not have an uuid, such as the console, the declared constant default uuid is used. This means that the console is subject to message repeat delays, which are shared by all non-uuid message recipients. (Are there more than console? Players and Entities both have uuids.)

This behavior could be adapted by generating random uuids, or specific uuids for various non-uuid message recipient types.

  • Method Details

    • of

      public static Optional<CooldownKey> of(Recipient.Sendable recipient, ValidMessageKey messageKey)
      Static factory method with Message parameter
      Parameters:
      recipient - the recipient used for CooldownKey creation
      messageKey - the message string used for CooldownKey creation
      Returns:
      Optional CooldownKey, or empty Optional if either parameter is invalid
    • getMessageKey

      public ValidMessageKey getMessageKey()
      Retrieve the message string used for this cooldown string
      Returns:
      the message string for this cooldown string
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object