Paradaux
0

Cooldown between creating businesses

Add a cooldown between creating businesses — users can spam create/disband firms, messing with chat.

Technical notesFirmServiceImpl.createFirm enforces a name check + an ownership-count limit (firmConfig.getOwnedFirmLimit()) but no time cooldown (there's a TODO: cost to open a business?). Add firm.create-cooldown-seconds to FirmConfiguration and check the actor's last firm created_at in createFirm (a FirmMapper.lastCreatedAtByOwner query, or an in-memory Map<UUID,Instant>), erroring if too soon. Keying on creation time — not active count — defeats the create/disband spam. (Pairs with PAR-24's disband idempotency.)

Comments

tesks · Jun 4, 2026, 9:56 AM

Code contextFirmServiceImpl.createFirm enforces a name check + an ownership-count limit (firmConfig.getOwnedFirmLimit()) but no time cooldown (there's even a TODO: cost to open a business?).

Approach: add firm.create-cooldown-seconds to FirmConfiguration and check the actor's last firm created_at in createFirm (a FirmMapper.lastCreatedAtByOwner query, or an in-memory Map<UUID,Instant>), erroring if too soon. Keying on creation time — not active count — is what defeats the create/disband chat spam.

tesks · Jun 5, 2026, 11:20 AM

Shipped on develop (commit a412741).

New firm.create-cooldown-seconds config (default 300s, <=0 disables) enforced in FirmServiceImpl.createFirm, after the name/uniqueness/ownership checks and before the DB insert. Exceeding it throws with a "wait Ns" message.

Keyed on creation time, not active count: FirmMapper.secondsSinceLastCreation does TIMESTAMPDIFF(SECOND, MAX(created_at), NOW()) over the player's firms including archived ones (created_at survives a disband), so a create→disband→create cycle is throttled too — which was the actual spam vector. Uses the DB clock for consistency.

Documented in the bundled config.yml. Tests: within-cooldown rejects (no insert), first-firm/null-elapsed passes the gate. Coverage gate green.

Note: ships enabled at 300s by default — since the live config.yml won't have the key it'll take the default. Drop create-cooldown-seconds: 0 into the live config if you want it off.

Activity

  • ParadauxIO linked a commit — Commit a412741 — Add a per-player firm creation cooldown (PAR-25)Jun 7, 2026, 2:49 PM
  • ParadauxIO changed status to Status → DoneJun 7, 2026, 2:49 PM
  • ParadauxIO linked a pull request — PR #6 merged — Release: develop → mainJun 7, 2026, 2:49 PM
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → mainJun 7, 2026, 12:36 AM
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → mainJun 6, 2026, 11:49 PM
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → mainJun 6, 2026, 12:44 PM
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → mainJun 6, 2026, 11:17 AM
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → mainJun 6, 2026, 11:11 AM
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → mainJun 5, 2026, 12:35 PM
  • tesks commentedJun 5, 2026, 11:20 AM
  • tesks changed status to Status → Pending ReleaseJun 5, 2026, 11:20 AM
  • ParadauxIO linked a commit — Commit a412741 — Add a per-player firm creation cooldown (PAR-25)Jun 5, 2026, 11:20 AM
  • tesks changed status to Status → In ProgressJun 5, 2026, 11:17 AM
  • tesks description: Description updatedJun 4, 2026, 10:01 AM
  • tesks commentedJun 4, 2026, 9:56 AM
  • tesks assigned Assigned to rianJun 4, 2026, 9:26 AM