diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-03-27 15:41:20 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-03-27 15:41:20 +0800 |
commit | 0cf3a67c2bbd4cdaa5d364436c9153e6456624f1 (patch) | |
tree | 03d6b37ee2f4109875050d61d63f363659031e6b /featureClass/featureManager.js | |
parent | b94794a3de8827f4bddb5251b010dc32943d79a1 (diff) | |
download | SoopyV2-0cf3a67c2bbd4cdaa5d364436c9153e6456624f1.tar.gz SoopyV2-0cf3a67c2bbd4cdaa5d364436c9153e6456624f1.tar.bz2 SoopyV2-0cf3a67c2bbd4cdaa5d364436c9153e6456624f1.zip |
make network requests all go on one permenantly open thread
Diffstat (limited to 'featureClass/featureManager.js')
-rw-r--r-- | featureClass/featureManager.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js index 200d413..934feca 100644 --- a/featureClass/featureManager.js +++ b/featureClass/featureManager.js @@ -5,6 +5,7 @@ import logger from "../logger"; const File = Java.type("java.io.File") import metadata from "../metadata.js" import soopyV2Server from "../socketConnection"; +import { fetch } from "../utils/networkUtils"; import { registerForge as registerForgeBase, unregisterForge as unregisterForgeBase} from "./forgeEvents.js" const JSLoader = Java.type("com.chattriggers.ctjs.engine.langs.js.JSLoader") @@ -73,7 +74,9 @@ class FeatureManager { new Thread(()=>{ try{ - FileLib.getUrlContent("http://soopymc.my.to/api/soopyv2/ping") + 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){ 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.") } |