Class Cooldown

java.lang.Object
me.lokka30.levelledmobs.misc.Cooldown

public class Cooldown extends Object
This class is used to put cooldowns on certain actions, on certain in-game objects - e.g. clicking entities or blocks.

For example, this is used in Debug Entity Damage to stop spam from clicking the same entity over and over. It is also used in the Spawner Info for the same reason: blocks unnecessary chat spam.

Since:
3.1.2
See Also:
  • Constructor Details

    • Cooldown

      public Cooldown(long startingTime, String identifier)
  • Method Details

    • doesCooldownBelongToIdentifier

      public boolean doesCooldownBelongToIdentifier(@NotNull @NotNull String identifier)
      Checks if this cooldown belongs to something with a certain ID.
      Parameters:
      identifier - ID to check if this cooldown has the same ID.
      Returns:
      if the IDs match.
    • hasCooldownExpired

      public boolean hasCooldownExpired(long requiredTimeInSeconds)
      Check if the cooldown's required time (seconds!) has surpassed since the starting point.
      Parameters:
      requiredTimeInSeconds - how many seconds should the cooldown have lasted?
      Returns:
      if the cooldown has expired.