From 73b1a8af4374b403763f7a7a7c8cefbc3e8b1ca4 Mon Sep 17 00:00:00 2001 From: Jens Forstmann <19289807+JensForstmann@users.noreply.github.com> Date: Sun, 8 Oct 2023 14:16:56 +0200 Subject: [PATCH] Improve check for existing maps on the server --- backend/src/matchMap.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/matchMap.ts b/backend/src/matchMap.ts index 6feb89f..85dae36 100644 --- a/backend/src/matchMap.ts +++ b/backend/src/matchMap.ts @@ -168,7 +168,8 @@ export const loadMap = async (match: Match.Match, matchMap: IMatchMap) => { await Match.say(match, `MAP WILL BE CHANGED TO ${matchMap.name} IN 15 SECONDS`); match.log(`change map to ${matchMap.name} (in 15 seconds)`); const response = await Match.execRcon(match, `maps ${matchMap.name}`); - if (!response.includes(matchMap.name)) { + const maps = response.trim().split("\n").map((map) => map.trim()); + if (!maps.includes(matchMap.name)) { match.log(`Map ${matchMap.name} could not be found on the server`); await Match.say(match, `Map ${matchMap.name} could not be found on the server`); return;