From 5b762b47963460b07039cc29b3a4135a4e374684 Mon Sep 17 00:00:00 2001 From: Fantino Davide Date: Wed, 7 Sep 2022 22:07:13 +0200 Subject: [PATCH] quick fix --- mapvote.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mapvote.js b/mapvote.js index ac576b5..6b0accc 100644 --- a/mapvote.js +++ b/mapvote.js @@ -138,8 +138,10 @@ export default class MapVote extends BasePlugin { setSeedingMode() { // setTimeout(()=>{this.msgDirect('76561198419229279',"MV\ntest\ntest")},1000) // this.msgBroadcast("[MapVote] Seeding mode active") - if (this && this.options && this.server && this.options.automaticSeedingMode && ((this.server.nextLayer && this.server.nextLayer.gamemode.toLowerCase() != "seed") || (this.server.currentLayer && this.server.nextLayer && this.server.currentLayer.layerid == this.server.nextLayer.layerid))) { - const seedingMaps = Layers.layers.filter((l) => l.gamemode.toUpperCase() == "SEED" && l.layerid != this.server.currentLayer.layerid && !this.options.layerLevelBlacklist.find((fl) => l.layerid.toLowerCase().startsWith(fl.toLowerCase()))) + const baseDataExist = this && this.options && this.server; + const currentNextLayerExist = this.server.currentLayer && this.server.nextLayer; + if (baseDataExist && this.options.automaticSeedingMode && ((this.server.nextLayer && this.server.nextLayer.gamemode.toLowerCase() != "seed") || (currentNextLayerExist && this.server.currentLayer.layerid == this.server.nextLayer.layerid))) { + const seedingMaps = Layers.layers.filter((l) => l.gamemode.toUpperCase() == "SEED" && (currentNextLayerExist && l.layerid != this.server.currentLayer.layerid && !this.options.layerLevelBlacklist.find((fl) => l.layerid.toLowerCase().startsWith(fl.toLowerCase())))) const nextMap = randomElement(seedingMaps).layerid; if (this.server.players && this.server.players.length < 20) {