aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
Diffstat (limited to 'features')
-rw-r--r--features/cosmetics/index.js2
-rw-r--r--features/dataLoader/index.js6
-rw-r--r--features/events/index.js6
-rw-r--r--features/stat_next_to_name/index.js10
4 files changed, 15 insertions, 9 deletions
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()