From dcb50fe8afcb14c8df99a97a1adb22bc848f659e Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Tue, 4 Oct 2022 00:01:05 +0200 Subject: [PATCH] workaround for removeEventListener crash issue --- mapvote.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mapvote.js b/mapvote.js index 74bd0c5..e4af8e4 100644 --- a/mapvote.js +++ b/mapvote.js @@ -534,16 +534,12 @@ export default class MapVote extends DiscordBasePlugin { if (playerCount < minPlayers && !force) { if (this.onConnectBound == false) { - this.server.on("PLAYER_CONNECTED", this.beginVoting) + setTimeout(() => { this.beginVoting(force, null, cmdLayers) }, 60 * 1000) this.onConnectBound = true; } return; } - if (this.onConnectBound) { - - this.server.removeEventListener("PLAYER_CONNECTED", this.beginVoting); - this.onConnectBound = false; - } + this.onConnectBound = false; // these need to be reset after reenabling voting this.trackedVotes = {};