mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 20:43:52 -06:00
fix: multiple end announcements after reroll
This commit is contained in:
parent
106ae758b2
commit
42bdb8484b
@ -202,6 +202,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.or_options = { ...this.options };
|
this.or_options = { ...this.options };
|
||||||
this.autovotestart = null;
|
this.autovotestart = null;
|
||||||
this.lastMapUpdate = new Date();
|
this.lastMapUpdate = new Date();
|
||||||
|
this.endVotingTimeout = null;
|
||||||
this.timeout_ps = []
|
this.timeout_ps = []
|
||||||
|
|
||||||
this.onNewGame = this.onNewGame.bind(this);
|
this.onNewGame = this.onNewGame.bind(this);
|
||||||
@ -252,7 +253,8 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
|
|
||||||
async onNewGame() {
|
async onNewGame() {
|
||||||
for (let x of this.timeout_ps) clearTimeout(this.timeout_ps.pop())
|
for (let x of this.timeout_ps) clearTimeout(this.timeout_ps.pop())
|
||||||
setTimeout(async () => {
|
|
||||||
|
this.endVotingTimeout = setTimeout(async () => {
|
||||||
this.endVoting();
|
this.endVoting();
|
||||||
this.trackedVotes = {};
|
this.trackedVotes = {};
|
||||||
this.tallies = [];
|
this.tallies = [];
|
||||||
@ -743,6 +745,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.votingEnabled = false;
|
this.votingEnabled = false;
|
||||||
clearInterval(this.broadcastIntervalTask);
|
clearInterval(this.broadcastIntervalTask);
|
||||||
clearTimeout(this.newVoteTimeout);
|
clearTimeout(this.newVoteTimeout);
|
||||||
|
clearTimeout(this.endVotingTimeout);
|
||||||
this.newVoteTimeout = null;
|
this.newVoteTimeout = null;
|
||||||
this.broadcastIntervalTask = null;
|
this.broadcastIntervalTask = null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user