From 100a437e2a1f05a1b2d506f924cf78214f83cbf1 Mon Sep 17 00:00:00 2001 From: Toast <96593068+AnxietyisReal@users.noreply.github.com> Date: Sat, 12 Aug 2023 19:46:03 +1000 Subject: [PATCH] Prevent MP function from throwing errors. --- src/MPLoop.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MPLoop.ts b/src/MPLoop.ts index 1d997a0..83a59d5 100644 --- a/src/MPLoop.ts +++ b/src/MPLoop.ts @@ -83,6 +83,7 @@ export default async(client:TClient,Channel:string,Message:string,ServerName:str const serverLog = client.channels.resolve(client.config.mainServer.channels.fs_server_log) as Discord.TextChannel; const playersOnServer = DSS.data.slots?.players.filter(x=>x.isUsed); const playersInCache = client.MPServerCache.players; + if (!playersOnServer) return console.error('[MPLoop] Empty filter, ignoring...'); // For the love of god, stop throwing errors everytime. playersOnServer.forEach(player=>playerData.push(`**${player.name} ${player.isAdmin ? '| admin' : ''}**\nFarming for ${client.formatPlayerUptime(player.uptime)}`)); ServerName = client.MPServerCache.name;