diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-03-14 07:29:13 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-03-14 07:29:13 +0800 |
commit | 85112750ba06483a028aa6fe84ce35699c0c56dd (patch) | |
tree | 29784398f863aa79c40355d60eebc47bfd375961 /features/dataLoader | |
parent | 423bf216fb0547446f9853adb9505bfd4174bbd5 (diff) | |
download | SoopyV2-85112750ba06483a028aa6fe84ce35699c0c56dd.tar.gz SoopyV2-85112750ba06483a028aa6fe84ce35699c0c56dd.tar.bz2 SoopyV2-85112750ba06483a028aa6fe84ce35699c0c56dd.zip |
Make networking more forgiving if my server is down
Diffstat (limited to 'features/dataLoader')
-rw-r--r-- | features/dataLoader/index.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index b4fb31a..19bdbba 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -39,12 +39,14 @@ class DataLoader extends Feature { } loadApi(){ - let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/v2/player_skyblock/" + Player.getUUID().replace(/-/g, ""))) + try{ + let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/v2/player_skyblock/" + Player.getUUID().replace(/-/g, ""))) - if(!data.success) return + if(!data.success) return - this.api_loaded_event.trigger(data, "skyblock", true, true) - this.lastApiData.skyblock = data + this.api_loaded_event.trigger(data, "skyblock", true, true) + this.lastApiData.skyblock = data + }catch(e){} } loadApiData(type, soopyServer){ @@ -64,12 +66,14 @@ class DataLoader extends Feature { }else{ if(type === "skyblock"){ - let data = JSON.parse(FileLib.getUrlContent("https://api.hypixel.net/skyblock/profiles?key=" + key + "&uuid=" + Player.getUUID().replace(/-/g, ""))) - - if(!data.success) return - - this.api_loaded_event.trigger(data, "skyblock", false, true) - this.lastApiData.skyblock_raw = data + try{ + let data = JSON.parse(FileLib.getUrlContent("https://api.hypixel.net/skyblock/profiles?key=" + key + "&uuid=" + Player.getUUID().replace(/-/g, ""))) + + if(!data.success) return + + this.api_loaded_event.trigger(data, "skyblock", false, true) + this.lastApiData.skyblock_raw = data + }catch(e){} } } } |