updateNextMap

This commit is contained in:
Davide Fantino 2022-10-04 19:48:38 +02:00
parent 12607a3d2e
commit c8370673d5

View File

@ -396,9 +396,11 @@ export default class MapVote extends DiscordBasePlugin {
}
if (!skipSetNextMap) {
const nextMap = randomElement(cpyWinners);
const baseDataExist = this && this.options && this.server && this.server.players && this.server.nextLayer && this.server.nextLayer.layerid;
if (!baseDataExist || this.server.nextLayer.layerid != nextMap)
const baseDataExist = this && this.server;
const layerDataExist = this.server.nextLayer && this.server.nextLayer.layerid;
if (baseDataExist && (!layerDataExist || this.server.nextLayer.layerid != nextMap))
this.server.rcon.execute(`AdminSetNextLayer ${nextMap}`);
else console.log("[MapVote][1] Bad data (this/this.server). Next layer not set to prevent errors.");
}
}