diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/cosmetics/index.js | 34 | ||||
-rw-r--r-- | features/dataLoader/index.js | 24 |
2 files changed, 32 insertions, 26 deletions
diff --git a/features/cosmetics/index.js b/features/cosmetics/index.js index e1879d0..826742a 100644 --- a/features/cosmetics/index.js +++ b/features/cosmetics/index.js @@ -83,24 +83,26 @@ class Cosmetics extends Feature { } loadCosmeticsData(){ - let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/soopyv2/cosmetics.json")) - - this.cosmeticsData = data - this.playerHasACosmeticA = !!data[Player.getUUID().toString().replace(/-/g,"")] - if(this.playerHasACosmeticA && !this.postRenderEntityTrigger){ - // this.registerEvent("postRenderEntity", this.renderEntity) - this.postRenderEntityTrigger = register("postRenderEntity", (entity, pos, ticks, event)=>{ - if(ticks !== 1) return - if(this.uuidToCosmeticDirect[entity.getUUID().toString().replace(/-/g,"")]){ - let cosmetics = Object.values(this.uuidToCosmeticDirect[entity.getUUID().toString().replace(/-/g,"")]) - for(let cosmetic of cosmetics){ - cosmetic.onRenderEntity(ticks, true) + try{ + let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/soopyv2/cosmetics.json")) + + this.cosmeticsData = data + this.playerHasACosmeticA = !!data[Player.getUUID().toString().replace(/-/g,"")] + if(this.playerHasACosmeticA && !this.postRenderEntityTrigger){ + // this.registerEvent("postRenderEntity", this.renderEntity) + this.postRenderEntityTrigger = register("postRenderEntity", (entity, pos, ticks, event)=>{ + if(ticks !== 1) return + if(this.uuidToCosmeticDirect[entity.getUUID().toString().replace(/-/g,"")]){ + let cosmetics = Object.values(this.uuidToCosmeticDirect[entity.getUUID().toString().replace(/-/g,"")]) + for(let cosmetic of cosmetics){ + cosmetic.onRenderEntity(ticks, true) + } } - } - }) - } + }) + } - this.scanForNewCosmetics() + this.scanForNewCosmetics() + }catch(e){} } setUserCosmeticsInformation(uuid, cosmetics){ diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index b4fb31a..19bdbba 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -39,12 +39,14 @@ class DataLoader extends Feature { } loadApi(){ - let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/v2/player_skyblock/" + Player.getUUID().replace(/-/g, ""))) + try{ + let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/v2/player_skyblock/" + Player.getUUID().replace(/-/g, ""))) - if(!data.success) return + if(!data.success) return - this.api_loaded_event.trigger(data, "skyblock", true, true) - this.lastApiData.skyblock = data + this.api_loaded_event.trigger(data, "skyblock", true, true) + this.lastApiData.skyblock = data + }catch(e){} } loadApiData(type, soopyServer){ @@ -64,12 +66,14 @@ class DataLoader extends Feature { }else{ if(type === "skyblock"){ - 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 + try{ + 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){} } } } |