diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-03-27 04:02:47 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-03-27 04:02:47 +0800 |
commit | b94794a3de8827f4bddb5251b010dc32943d79a1 (patch) | |
tree | 270b5b8ca4b85677cca1199aecd0268e211de678 | |
parent | 61f813aa1ab67ffcf0be66e6690c04a1c501c21e (diff) | |
download | SoopyV2-b94794a3de8827f4bddb5251b010dc32943d79a1.tar.gz SoopyV2-b94794a3de8827f4bddb5251b010dc32943d79a1.tar.bz2 SoopyV2-b94794a3de8827f4bddb5251b010dc32943d79a1.zip |
fixes + make diana retry untill it works
-rw-r--r-- | featureClass/featureManager.js | 2 | ||||
-rw-r--r-- | features/cosmetics/index.js | 2 | ||||
-rw-r--r-- | features/dataLoader/index.js | 6 | ||||
-rw-r--r-- | features/events/index.js | 6 | ||||
-rw-r--r-- | features/stat_next_to_name/index.js | 10 | ||||
-rw-r--r-- | metadata.json | 4 |
6 files changed, 18 insertions, 12 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js index 113e1cb..200d413 100644 --- a/featureClass/featureManager.js +++ b/featureClass/featureManager.js @@ -314,7 +314,7 @@ class FeatureManager { Event.func.call(Event.context, ...args) let time = Date.now()-start if(time > this.longEventTime){ - logger.logMessage("Long event triggered [" + time + "ms] (" + context.constructor.name + "/" + event + ")", 3) + logger.logMessage("Long event triggered [" + time + "ms] (" + Event.context.constructor.name + "/" + event + ")", 3) } this.stopRecordingPerformance(Event.context.constructor.name, event) } diff --git a/features/cosmetics/index.js b/features/cosmetics/index.js index 826742a..ec8a094 100644 --- a/features/cosmetics/index.js +++ b/features/cosmetics/index.js @@ -61,7 +61,7 @@ class Cosmetics extends Feature { // }) // this.registerEvent("renderEntity", this.renderEntity) - if(global.soopyV2Server.userCosmeticPermissions){ + if(global.soopyV2Server && global.soopyV2Server.userCosmeticPermissions){ this.updateUserCosmeticPermissionSettings() } } diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index 19bdbba..7bf2bf9 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -67,13 +67,17 @@ class DataLoader extends Feature { }else{ if(type === "skyblock"){ try{ + // console.log("loading") 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){} + }catch(e){ + console.log("Hypixel api request failed:") + console.log(JSON.stringify(e, undefined, 2)) + } } } } diff --git a/features/events/index.js b/features/events/index.js index 5bab213..912e566 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -195,7 +195,11 @@ class Events extends Feature { loadApi(){ new Thread(()=>{ - this.FeatureManager.features["dataLoader"].class.loadApiData("skyblock", false) + while(this.nextUpdateApprox === -2){ + this.FeatureManager.features["dataLoader"].class.loadApiData("skyblock", false) + + Thread.sleep(5000) + } }).start() } diff --git a/features/stat_next_to_name/index.js b/features/stat_next_to_name/index.js index 41c19df..5c8ab5e 100644 --- a/features/stat_next_to_name/index.js +++ b/features/stat_next_to_name/index.js @@ -31,7 +31,6 @@ class StatNextToName extends Feature { "networth": "small" } - this.oldUserStats = {} this.userStats = {} this.loadingStats = [] @@ -51,7 +50,7 @@ class StatNextToName extends Feature { if(this.lastWorldLoad && Date.now() - this.lastWorldLoad > 1000){ World.getAllPlayers().forEach(player => { - if(this.userStats[player.getUUID().toString().replace(/-/g, "")] || this.oldUserStats[player.getUUID().toString().replace(/-/g, "")]) return + if(this.userStats[player.getUUID().toString().replace(/-/g, "")]) return if(Player.getUUID().replace(/-/g, "").toString().substr(12, 1) !== "4") return this.loadPlayerStatsCache(player.getUUID().toString().replace(/-/g, ""), player.getName()) }) @@ -63,7 +62,7 @@ class StatNextToName extends Feature { let nearestDistance = Infinity World.getAllPlayers().forEach(player => { - if(this.userStats[player.getUUID().toString().replace(/-/g, "")] || this.oldUserStats[player.getUUID().toString().replace(/-/g, "")]){ + if(this.userStats[player.getUUID().toString().replace(/-/g, "")]){ this.updatePlayerNametag(player) return } @@ -85,7 +84,6 @@ class StatNextToName extends Feature { worldLoad(){ let playerStats = this.userStats[Player.getUUID().toString().replace(/-/g, "")] - this.oldUserStats = this.userStats this.userStats = {} this.loadingStats = [] if(playerStats){ @@ -97,14 +95,14 @@ class StatNextToName extends Feature { playerJoined(player){ if(player.getUUID().toString().replace(/-/g,"") === Player.getUUID().toString().replace(/-/g,"")) return - if(this.userStats[player.getUUID().toString().replace(/-/g, "")] || this.oldUserStats[player.getUUID().toString().replace(/-/g, "")]) return + if(this.userStats[player.getUUID().toString().replace(/-/g, "")]) return if(Player.getUUID().replace(/-/g, "").toString().substr(12, 1) !== "4") return this.loadPlayerStatsCache(player.getUUID().toString().replace(/-/g, ""), player.getName()) } updatePlayerNametag(player){ - let stats = this.userStats[player.getUUID().toString().replace(/-/g, "")] || this.oldUserStats[player.getUUID().toString().replace(/-/g, "")] + let stats = this.userStats[player.getUUID().toString().replace(/-/g, "")] let nameTagString = player.getName() diff --git a/metadata.json b/metadata.json index 3da6e7c..8e3ea07 100644 --- a/metadata.json +++ b/metadata.json @@ -5,7 +5,7 @@ "entry": "index.js", "description": "Soopy addons v2", "name": "SoopyV2", - "version": "2.1.38", - "versionId": 165, + "version": "2.1.39", + "versionId": 166, "requires": ["soopyApis", "soopyAddonsData", "CustomTabCompletions", "guimanager", "mappings"] } |