Class CooldownManager.Cooldown
java.lang.Object
me.mehboss.utils.CooldownManager.Cooldown
- Enclosing class:
CooldownManager
Represents a cooldown timer for a specific recipe.
A cooldown consists of:
- The recipe ID
- The cooldown duration (seconds)
- The timestamp when the cooldown started
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonglonglongCalculates how many seconds remain.booleanChecks whether the cooldown has completed.
-
Constructor Details
-
Cooldown
Creates a new cooldown timer starting immediately.- Parameters:
recipeID- The recipe to restrict.durationSeconds- Duration in seconds.
-
-
Method Details
-
getRecipeID
- Returns:
- The recipe ID this cooldown belongs to.
-
getDuration
public long getDuration()- Returns:
- The cooldown duration in seconds.
-
getStartTime
public long getStartTime()- Returns:
- The timestamp when the cooldown began (ms).
-
getTimeLeft
public long getTimeLeft()Calculates how many seconds remain.- Returns:
- Seconds left, never negative.
-
isExpired
public boolean isExpired()Checks whether the cooldown has completed.- Returns:
trueif expired, else false.
-