diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/hypixel.js | 4 | ||||
-rw-r--r-- | build/hypixelCached.js | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/build/hypixel.js b/build/hypixel.js index ee81fb5..ace7540 100644 --- a/build/hypixel.js +++ b/build/hypixel.js @@ -63,6 +63,10 @@ async function fetchUser({ user, uuid, username }, included = ['player']) { // If the uuid isn't provided, get it uuid = await cached.uuidFromUser(user || username); } + if (!uuid) { + // the user doesn't exist. + return null; + } const includePlayers = included.includes('player'); const includeProfiles = included.includes('profiles'); let profilesData; diff --git a/build/hypixelCached.js b/build/hypixelCached.js index 660bab4..15a1cec 100644 --- a/build/hypixelCached.js +++ b/build/hypixelCached.js @@ -77,6 +77,8 @@ async function uuidFromUser(user) { } // not cached, actually fetch mojang api now let { uuid, username } = await mojang.mojangDataFromUser(user); + if (!uuid) + return; // remove dashes from the uuid so its more normal uuid = util_1.undashUuid(uuid); usernameCache.set(uuid, username); @@ -109,6 +111,7 @@ async function fetchPlayer(user) { // clone in case it gets modified somehow later const cleanPlayerClone = Object.assign({}, cleanPlayer); playerCache.set(playerUuid, cleanPlayerClone); + usernameCache.set(playerUuid, cleanPlayerClone.username); return cleanPlayer; } exports.fetchPlayer = fetchPlayer; |