fixed automatic vote start during seeding always starting

This commit is contained in:
Davide Fantino 2022-11-07 13:03:26 +01:00
parent 07cf40008a
commit 97d813e54e

View File

@ -581,6 +581,8 @@ export default class MapVote extends DiscordBasePlugin {
//checks if there are enough players to start voting, if not binds itself to player connected //checks if there are enough players to start voting, if not binds itself to player connected
//when there are enough players it clears old votes, sets up new nominations, and starts broadcast //when there are enough players it clears old votes, sets up new nominations, and starts broadcast
beginVoting(force = false, steamid = null, cmdLayers = []) { beginVoting(force = false, steamid = null, cmdLayers = []) {
if (!this.options.automaticVoteStart && !force) return;
this.verbose(1, "Starting vote") this.verbose(1, "Starting vote")
const playerCount = this.server.players.length; const playerCount = this.server.players.length;
const minPlayers = this.options.minPlayersForVote; const minPlayers = this.options.minPlayersForVote;
@ -588,6 +590,7 @@ export default class MapVote extends DiscordBasePlugin {
if (this.votingEnabled) //voting has already started if (this.votingEnabled) //voting has already started
return; return;
if (playerCount < minPlayers && !force) { if (playerCount < minPlayers && !force) {
this.autovotestart = setTimeout(() => { this.beginVoting(force, steamid, cmdLayers) }, 60 * 1000) this.autovotestart = setTimeout(() => { this.beginVoting(force, steamid, cmdLayers) }, 60 * 1000)
return; return;