diff options
| author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-29 12:06:18 +0800 |
|---|---|---|
| committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-29 12:06:18 +0800 |
| commit | 9ec9aa2d495df5a6c48b8edbd5fe31052d20b37b (patch) | |
| tree | aa20f5314241d517b0a50b123926077685fb700e /features/dataLoader | |
| parent | a6593709b0e1e99e241b6c163fe66623685b6efc (diff) | |
| parent | 51cdd4ca4ea64e1a9a67b99c274693a54f7f535d (diff) | |
| download | SoopyV2-9ec9aa2d495df5a6c48b8edbd5fe31052d20b37b.tar.gz SoopyV2-9ec9aa2d495df5a6c48b8edbd5fe31052d20b37b.tar.bz2 SoopyV2-9ec9aa2d495df5a6c48b8edbd5fe31052d20b37b.zip | |
Merge branch 'master' of https://github.com/Soopyboo32/SoopyV2
Diffstat (limited to 'features/dataLoader')
| -rw-r--r-- | features/dataLoader/index.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index f0ede23..849e0fd 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -23,6 +23,8 @@ class DataLoader extends Feature { this.registerStep(true, 2, this.step) + this.registerStep(false, 170, this.loadApiStepThing) + this.registerEvent("worldLoad", this.worldLoad) this.api_loaded_event = this.createCustomEvent("apiLoad") @@ -42,13 +44,19 @@ class DataLoader extends Feature { this.worldLoaded = true this.loadApi() + + this.firstLoaded = false } worldLoad() { this.area = undefined this.areaFine = undefined + this.loadApiData("skyblock", false) } + loadApiStepThing() { + this.loadApiData("skyblock", false) + } loadApi() { fetch("http://soopymc.my.to/api/v2/player_skyblock/" + Player.getUUID().replace(/-/g, "")).json(data => { @@ -87,6 +95,12 @@ class DataLoader extends Feature { } step() { //2fps + if (!this.firstLoaded) { + if (!(this.FeatureManager.features["globalSettings"] === undefined || this.FeatureManager.features["globalSettings"].class.apiKeySetting === undefined)) { + this.loadApiData("skyblock", false) + this.firstLoaded = true + } + } this.isInSkyblock = Scoreboard.getTitle()?.removeFormatting().includes("SKYBLOCK") if (!this.isInSkyblock) { @@ -151,11 +165,11 @@ class DataLoader extends Feature { this.area = this.stats["Area"] - if (this.lastServer !== this.FeatureManager.features["dataLoader"].class.stats.Server || Date.now() - this.lastSentServer > 60000 * 5) { - this.lastServer = this.FeatureManager.features["dataLoader"].class.stats.Server; + if (this.lastServer !== this.stats.Server || Date.now() - this.lastSentServer > 60000 * 5) { + this.lastServer = this.stats.Server; this.lastSentServer = Date.now() - socketConnection.setServer(this.FeatureManager.features["dataLoader"].class.stats.Server); + socketConnection.setServer(this.stats.Server, this.area, this.areaFine); } } |
