Paradaux

PAR-25

0

Cooldown between creating businesses

DoneLowrianBusinessImprovement

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.)

Resources

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)
  • ParadauxIO changed status to Status → Done
  • ParadauxIO linked a pull request — PR #6 merged — Release: develop → main
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → main
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → main
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → main
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → main
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → main
  • ParadauxIO linked a pull request — PR #6 open — Release: develop → main
  • tesks commented
  • tesks changed status to Status → Pending Release
  • ParadauxIO linked a commit — Commit a412741 — Add a per-player firm creation cooldown (PAR-25)
  • tesks changed status to Status → In Progress
  • tesks description: Description updated
  • tesks commented
  • tesks assigned Assigned to rian