Skip to content

Commit

Permalink
refactro(stats): switch from slothpixel API to Hypixel's
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckySoLucky committed Feb 2, 2025
1 parent 2a2335c commit f159e7b
Show file tree
Hide file tree
Showing 7 changed files with 545 additions and 38 deletions.
5 changes: 0 additions & 5 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { updateCollections } from "$constants/update-collections";
import { updateItems } from "$constants/update-items";
import { init as resourcesInit } from "$lib/server/custom_resources";
import { indexCollectons } from "$lib/server/db/mongo/index-collections";
import { intializeNEURepository, parseNEURepository } from "$lib/server/helper/NotEnoughUpdates/parseNEURepository";
Expand All @@ -20,9 +18,6 @@ export const init: ServerInit = async () => {
await startMongo()?.then(() => {
console.log("[MONGO] MongoDB successfully connected");

updateItems();
updateCollections();

indexCollectons();
});

Expand Down
7 changes: 4 additions & 3 deletions src/lib/server/constants/accessories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// CREDITS: https://github.com/MattTheCuber (Modified)
import { ITEMS } from "$lib/shared/constants/items";
import type { SpecialAccessory, SpecialAccessoryConstant, allAccessories } from "$types/stats";
import { updateItems } from "./update-items";
import { updateItemsConstants } from "./update-items";

let ACCESSORIES = [] as allAccessories[];
function getAccessories() {
Expand All @@ -15,8 +15,9 @@ function getAccessories() {
ACCESSORIES = output;
}

if (ITEMS.size === 0) {
await updateItems();
if (ITEMS.size === 0 || ACCESSORIES.length === 0) {
await updateItemsConstants();
getAccessories();
}

setTimeout(getAccessories, 60 * 60 * 1000); // 1 hour
Expand Down
Loading

0 comments on commit f159e7b

Please sign in to comment.