added voting duration option

This commit is contained in:
Davide Fantino 2022-10-20 23:59:28 +02:00
parent 9c753932aa
commit 5b09c79881
2 changed files with 28 additions and 9 deletions

View File

@ -35,25 +35,39 @@ The command name to use in chat.
``` ```
!vote !vote
``` ```
#### automaticVoteStart
###### Description
A map vote will automatically start after a new match if set to true.
###### Default
```json
true
```
#### votingDuration
###### Description
How long the voting will be active (in minutes). Set to 0 for unlimited time.
###### Default
```json
0
```
#### minPlayersForVote #### minPlayersForVote
###### Description ###### Description
The number of players needed on the server for a vote to start. The number of players needed on the server for a vote to start.
###### Default ###### Default
``` ```json
40 40
``` ```
#### voteWaitTimeFromMatchStart #### voteWaitTimeFromMatchStart
###### Description ###### Description
The time in mins from the start of a round to the start of a new map vote. The time in mins from the start of a round to the start of a new map vote.
###### Default ###### Default
``` ```json
15 15
``` ```
#### voteBroadcastInterval #### voteBroadcastInterval
###### Description ###### Description
The broadcast interval for vote notification in mins. The broadcast interval for vote notification in mins.
###### Default ###### Default
``` ```json
7 7
``` ```
#### automaticSeedingMode #### automaticSeedingMode
@ -67,7 +81,7 @@ true
###### Description ###### Description
The random layer list will not include the X recent maps The random layer list will not include the X recent maps
###### Default ###### Default
``` ```json
4 4
``` ```
#### gamemodeWhitelist #### gamemodeWhitelist
@ -180,6 +194,7 @@ Array of timeframes that allows to override options based on local time. See exa
"enabled": true, "enabled": true,
"discordClient": "discord", "discordClient": "discord",
"automaticVoteStart": true, "automaticVoteStart": true,
"votingDuration": 0,
"minPlayersForVote": 30, "minPlayersForVote": 30,
"voteWaitTimeFromMatchStart": 10, "voteWaitTimeFromMatchStart": 10,
"voteBroadcastInterval": 7, "voteBroadcastInterval": 7,
@ -188,6 +203,7 @@ Array of timeframes that allows to override options based on local time. See exa
"gamemodeWhitelist": [ "AAS", "RAAS", "Invasion" ], "gamemodeWhitelist": [ "AAS", "RAAS", "Invasion" ],
"layerLevelBlacklist": [ "BlackCoast_Seed" ], "layerLevelBlacklist": [ "BlackCoast_Seed" ],
"layerLevelWhitelist": [ "Yeho", "Gorodok", "Mutaha", "Narva", "Tallil" ], "layerLevelWhitelist": [ "Yeho", "Gorodok", "Mutaha", "Narva", "Tallil" ],
"applyBlacklistToWhitelist": true,
"hideVotesCount": false, "hideVotesCount": false,
"showRerollOption": false, "showRerollOption": false,
"voteBroadcastMessage": "✯ MAPVOTE ✯ Vote for the next map by writing in chat the corresponding number!", "voteBroadcastMessage": "✯ MAPVOTE ✯ Vote for the next map by writing in chat the corresponding number!",

View File

@ -31,6 +31,11 @@ export default class MapVote extends DiscordBasePlugin {
description: "a map vote will automatically start after a new match if set to true", description: "a map vote will automatically start after a new match if set to true",
default: true default: true
}, },
votingDuration: {
required: false,
description: "How long the voting will be active (in minutes). Set to 0 for unlimited time.",
default: 0
},
minPlayersForVote: minPlayersForVote:
{ {
required: false, required: false,
@ -559,13 +564,11 @@ export default class MapVote extends DiscordBasePlugin {
return; return;
if (playerCount < minPlayers && !force) { if (playerCount < minPlayers && !force) {
if (this.onConnectBound == false) { this.autovotestart = setTimeout(() => { this.beginVoting(force, steamid, cmdLayers) }, 60 * 1000)
setTimeout(() => { this.beginVoting(force, null, cmdLayers) }, 60 * 1000)
this.onConnectBound = true;
}
return; return;
} }
this.onConnectBound = false;
if (this.options.votingDuration > 0) setTimeout(this.endVoting, this.options.votingDuration * 60 * 1000)
// these need to be reset after reenabling voting // these need to be reset after reenabling voting
this.trackedVotes = {}; this.trackedVotes = {};