workaround for removeEventListener crash issue

This commit is contained in:
Davide Fantino 2022-10-04 00:01:05 +02:00
parent 2c0a048e25
commit dcb50fe8af

View File

@ -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 = {};