diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-02 11:11:17 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-02 11:11:17 +0800 |
commit | 3151ad980883a1969500a93a4f4504ac19e4c9a8 (patch) | |
tree | 0520ea5ae60aefb071c5ce5122104c39bca0abe0 /featureClass | |
parent | 1855ae3ac49d0bc4e963566563112c0e6bc2c21b (diff) | |
download | SoopyV2-3151ad980883a1969500a93a4f4504ac19e4c9a8.tar.gz SoopyV2-3151ad980883a1969500a93a4f4504ac19e4c9a8.tar.bz2 SoopyV2-3151ad980883a1969500a93a4f4504ac19e4c9a8.zip |
Make more features work when my server is down
Diffstat (limited to 'featureClass')
-rw-r--r-- | featureClass/featureManager.js | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js index 934feca..8b5a023 100644 --- a/featureClass/featureManager.js +++ b/featureClass/featureManager.js @@ -71,28 +71,25 @@ class FeatureManager { this.featureSettingsData = {} - new Thread(()=>{ - - try{ - if(fetch("http://soopymc.my.to/api/soopyv2/ping").responseCode() >= 400){ - ChatLib.chat(this.messagePrefix + "&cError: Could not connect to Soopy's server. This may cause issues with features breaking but will (hopefully) be back soon.") - } - }catch(e){ + let fetchD = fetch("http://soopymc.my.to/api/soopyv2/ping").async(d=>{ + if(fetchD.responseCode() >= 400 || fetchD.responseCode() === -1){ ChatLib.chat(this.messagePrefix + "&cError: Could not connect to Soopy's server. This may cause issues with features breaking but will (hopefully) be back soon.") } - - this.loadFeatureMetas() - - this.loadFeatureSettings() - Object.keys(this.featureMetas).forEach((feature)=>{ - if(this.featureSettingsData[feature] && this.featureSettingsData[feature].enabled){ - this.loadFeature(feature) - } - }) - - this.finishedLoading = true - }).start() + new Thread(()=>{ + this.loadFeatureMetas() + + this.loadFeatureSettings() + + Object.keys(this.featureMetas).forEach((feature)=>{ + if(this.featureSettingsData[feature] && this.featureSettingsData[feature].enabled){ + this.loadFeature(feature) + } + }) + + this.finishedLoading = true + }).start() + }, true) this.registerStep(false, 30, ()=>{ if(this.featureSettingsDataLastUpdated){ |