From 82a8610e1d5b41b2da3bd6c2e8cf70713992978c Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Mon, 1 Mar 2021 21:11:19 -0600 Subject: Fix error on some profiles with inventory API --- build/cleaners/skyblock/inventory.js | 11 ++++++----- src/cleaners/skyblock/inventory.ts | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build/cleaners/skyblock/inventory.js b/build/cleaners/skyblock/inventory.js index 6892c6e..c2bb3f6 100644 --- a/build/cleaners/skyblock/inventory.js +++ b/build/cleaners/skyblock/inventory.js @@ -83,12 +83,13 @@ async function cleanInventories(data) { const hypixelInventoryName = exports.INVENTORIES[cleanInventoryName]; const encodedInventoryContents = (_a = data[hypixelInventoryName]) === null || _a === void 0 ? void 0 : _a.data; let inventoryContents; - if (encodedInventoryContents) + if (encodedInventoryContents) { inventoryContents = await cleanInventory(encodedInventoryContents); - if (cleanInventoryName === 'armor') - // the armor is sent from boots to head, the opposite makes more sense - inventoryContents.reverse(); - cleanInventories[cleanInventoryName] = inventoryContents; + if (cleanInventoryName === 'armor') + // the armor is sent from boots to head, the opposite makes more sense + inventoryContents.reverse(); + cleanInventories[cleanInventoryName] = inventoryContents; + } } return cleanInventories; } diff --git a/src/cleaners/skyblock/inventory.ts b/src/cleaners/skyblock/inventory.ts index ed9b5ed..76acf60 100644 --- a/src/cleaners/skyblock/inventory.ts +++ b/src/cleaners/skyblock/inventory.ts @@ -91,14 +91,15 @@ export async function cleanInventories(data: any): Promise { const hypixelInventoryName = INVENTORIES[cleanInventoryName] const encodedInventoryContents = data[hypixelInventoryName]?.data let inventoryContents: Inventory - if (encodedInventoryContents) + if (encodedInventoryContents) { inventoryContents = await cleanInventory(encodedInventoryContents) - if (cleanInventoryName === 'armor') - // the armor is sent from boots to head, the opposite makes more sense - inventoryContents.reverse() + if (cleanInventoryName === 'armor') + // the armor is sent from boots to head, the opposite makes more sense + inventoryContents.reverse() - cleanInventories[cleanInventoryName] = inventoryContents + cleanInventories[cleanInventoryName] = inventoryContents + } } return cleanInventories } \ No newline at end of file -- cgit