From ef2e226803a11f8e20a7554d6a1c6f26c0766bad Mon Sep 17 00:00:00 2001 From: MDMCK10 <21245760+MDMCK10@users.noreply.github.com> Date: Wed, 5 Apr 2023 17:04:21 +0200 Subject: [PATCH] Only allow one active turn per IP address --- src/WSServer.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/WSServer.ts b/src/WSServer.ts index 0c7e23b..f53fd33 100644 --- a/src/WSServer.ts +++ b/src/WSServer.ts @@ -275,11 +275,14 @@ export default class WSServer { break; } if (takingTurn) { + var currentQueue = this.TurnQueue.toArray(); // If the user is already in the queue, fuck them off - if (this.TurnQueue.toArray().indexOf(client) !== -1) return; + if (currentQueue.indexOf(client) !== -1) return; // If they're muted, also fuck them off. // Send them the turn queue to prevent client glitches if (client.IP.muted) return; + // Only allow one active turn per IP address + if(currentQueue.find(user => user.IP.address == client.IP.address)) return; this.TurnQueue.enqueue(client); if (this.TurnQueue.size === 1) this.nextTurn(); } else {