diff options
Diffstat (limited to 'build/mojang.js')
-rw-r--r-- | build/mojang.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/build/mojang.js b/build/mojang.js index b740c5a..5216d39 100644 --- a/build/mojang.js +++ b/build/mojang.js @@ -29,14 +29,24 @@ async function profileFromUuid(uuid) { await new Promise((resolve) => setTimeout(resolve, 1000)); return await profileFromUuid(uuid); } + let dataString; + try { + dataString = await fetchResponse.text(); + } + catch { + return { uuid: null, username: null }; + } let data; try { - data = await fetchResponse.json(); + data = JSON.parse(dataString); } catch { + console.log('mojang response:', dataString); // if it errors, just return null return { uuid: null, username: null }; } + if (!data.id) + console.log('mojang response:', data); return { uuid: data.id, username: data.name |