From 2c0a048e25475607ebca064ccb06181232860246 Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Mon, 3 Oct 2022 12:28:50 +0200 Subject: [PATCH] reduced AdminSetNextLayer calls --- mapvote.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mapvote.js b/mapvote.js index d508871..74bd0c5 100644 --- a/mapvote.js +++ b/mapvote.js @@ -385,7 +385,9 @@ export default class MapVote extends DiscordBasePlugin { } if (!skipSetNextMap) { const nextMap = randomElement(cpyWinners); - this.server.rcon.execute(`AdminSetNextLayer ${nextMap}`); + const baseDataExist = this && this.options && this.server && this.server.players && this.server.nextLayer && this.server.nextLayer.layerid; + if (!baseDataExist || this.server.nextLayer.layerid != nextMap) + this.server.rcon.execute(`AdminSetNextLayer ${nextMap}`); } }