Skip to content

Definitions: Introduced the enforcement of definition cooldowns - #14

Open
whereareiam wants to merge 3 commits into
devfrom
feature/cooldowns
Open

whereareiam wants to merge 3 commits into
devfrom
feature/cooldowns

Conversation

@whereareiam

Copy link
Copy Markdown
Owner

Summary

DefinitionAdapter.Cooldown was part of the API, but nothing applied it, so cooldowns from definitions had no effect.

  • DefinitionParser marks a definition's command with Cloud's cooldown metadata, for getDuration() seconds. Definitions that name the same group share one cooldown; a blank group gives a definition a cooldown of its own, shared by its aliases. Disabled cooldowns and durations of zero or less are ignored.
  • New CommandCooldowns.register(...) in me.whereareiam.commandant.cooldown registers Cloud's cooldown postprocessor. It keeps cooldowns per sender (Actor#getUniqueId()) in memory, never limits the console (Console.CONSOLE_UUID), and sends the new cooldown message with the seconds left as content. It has overloads for a static ExceptionMessages, a Supplier<ExceptionMessages> (picks up reloads), and ExceptionMessageKeys with a MessageResolver.
  • clear(UUID) ends a sender's cooldowns early, for example when a player leaves; close() stops the background cleanup of expired cooldowns.
  • ExceptionMessages.cooldown and ExceptionMessageKeys.cooldown (commandant.exception.cooldown in defaults()) are new.

Identica uses this in whereareiam/Identica (draft PR to follow), built against a Maven-local 1.1.0-local-92b2219 of this branch.

Release notes

  • The title follows Area: Description with a listed area
  • The title describes the effect in the past tense, for example Help: Fixed ...
  • Exactly one label: feature, change, bug, dependencies, or skip-changelog
  • bug only for a bug that shipped in a release; a fix for a bug that only existed on dev is skip-changelog
  • major added when plugins must change their code on upgrade
  • Upgrade steps added to .github/release-notes.md, if plugins need them

Checks

  • Tests added or updated (CommandCooldownsTest: refusal and expiry, per sender, shared and blank groups, disabled and empty cooldowns, console, clear)
  • Javadocs updated for changed public API

./gradlew test passes locally.

🤖 Generated with Claude Code

@whereareiam whereareiam added the feature Something new for users or developers label Oct 17, 2026
@whereareiam whereareiam changed the title Definitions: Introduced cooldowns that commands of a definition enforce Definitions: Introduced the enforcement of definition cooldowns Oct 17, 2026
whereareiam and others added 3 commits November 17, 2026 19:02
DefinitionParser marks a command with the cooldown of its definition,
in seconds and in its group, or in a group of the definition's own when
the group is blank. CommandCooldowns registers Cloud's cooldown
postprocessor, keeps cooldowns per sender, lets the console through and
sends the new cooldown message of ExceptionMessages with the seconds
left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Something new for users or developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant