Add per-recipient cooldown to QuickChatExecution (#4012)

`QuickChatExecution` had no cooldown, allowing a player to spam
quick-chat intents and flood a recipient's chat UI. This could bury
incoming alliance request notifications, preventing them from being seen
or accepted.

This fix mirrors the existing emoji cooldown pattern:

- Added `quickChatCooldown()` to `Config` (default: 30 ticks / 3 seconds)
- Added `canSendQuickChat(recipient)` and `recordQuickChat(recipient)`
to `Player` / `PlayerImpl`, tracking outgoing chats per recipient
- `QuickChatExecution.tick()` now checks `canSendQuickChat` before
displaying and records before the display calls (so the cooldown is
always written even if display throws)
This commit is contained in:
Josh Harris
2026-05-31 15:20:46 +01:00
committed by Josh Harris
parent 712b2bc473
commit 413efed895
5 changed files with 113 additions and 0 deletions
+7
View File
@@ -27,8 +27,15 @@ export class QuickChatExecution implements Execution {
}
tick(ticks: number): void {
if (!this.sender.canSendQuickChat(this.recipient)) {
this.active = false;
return;
}
const message = this.getMessageFromKey(this.quickChatKey);
this.sender.recordQuickChat(this.recipient);
this.mg.displayChat(
message[1],
message[0],