Add a cooldown between creating businesses — users can spam create/disband firms, messing with chat.
Technical notes — FirmServiceImpl.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.)
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.
Code context —
FirmServiceImpl.createFirmenforces a name check + an ownership-count limit (firmConfig.getOwnedFirmLimit()) but no time cooldown (there's even aTODO: cost to open a business?).Approach: add
firm.create-cooldown-secondstoFirmConfigurationand check the actor's last firmcreated_atincreateFirm(aFirmMapper.lastCreatedAtByOwnerquery, or an in-memoryMap<UUID,Instant>), erroring if too soon. Keying on creation time — not active count — is what defeats the create/disband chat spam.