From 0981a89bcb8fb428fbe0a68f76597851cb7b108c Mon Sep 17 00:00:00 2001 From: maskedmonkyman Date: Sat, 2 Apr 2022 16:04:23 -0700 Subject: [PATCH] fixed bug where a second vote could start after new game --- mapvote.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mapvote.js b/mapvote.js index 7b84026..e98f804 100644 --- a/mapvote.js +++ b/mapvote.js @@ -324,6 +324,10 @@ export default class MapVote extends BasePlugin { const playerCount = this.server.players.length; const minPlayers = this.options.minPlayersForVote; + + if (this.votingEnabled) //voting has already started + return; + if (playerCount < minPlayers && !force) { if (this.onConnectBound == false) @@ -333,11 +337,12 @@ export default class MapVote extends BasePlugin } return; } - if(this.onConnectBound) + if (this.onConnectBound) { this.server.removeEventListener("PLAYER_CONNECTED", this.beginVoting); this.onConnectBound = false; } + // these need to be reset after reenabling voting this.trackedVotes = {}; this.tallies = [];