From 65a10a92d620ce176991d0631bf0a2fa2c4a2e69 Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Sat, 1 Oct 2022 14:30:26 +0200 Subject: [PATCH] fix for player disconnecting caused a next map update spam --- mapvote.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mapvote.js b/mapvote.js index be48c79..d508871 100644 --- a/mapvote.js +++ b/mapvote.js @@ -140,6 +140,7 @@ export default class MapVote extends DiscordBasePlugin { }; this.or_options = { ...this.options }; this.autovotestart = null; + this.lastMapUpdate = new Date(); this.onNewGame = this.onNewGame.bind(this); this.onPlayerDisconnected = this.onPlayerDisconnected.bind(this); @@ -193,7 +194,7 @@ export default class MapVote extends DiscordBasePlugin { if (!this.votingEnabled) return; await this.server.updatePlayerList(); this.clearVote(); - this.updateNextMap(); + if (new Date() - this.lastMapUpdate > 5 * 1000) this.updateNextMap(); } async timeframeOptionOverrider() { const orOpt = { ...this.or_options }; @@ -359,6 +360,7 @@ export default class MapVote extends DiscordBasePlugin { updateNextMap() //sets next map to current mapvote winner, if there is a tie will pick at random { + this.lastMapUpdate = new Date(); let cpyWinners = this.currentWinners; let skipSetNextMap = false; if (cpyWinners.find(e => e == this.nominations[ 0 ])) {