diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-07-26 19:49:12 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-07-26 19:49:12 +0800 |
commit | aadc96313266643cc57e4e1d01112c41df0ac8a7 (patch) | |
tree | 782b0ab137a70d0ccec4069148879054964e00d9 /features/stat_next_to_name | |
parent | 2aee47bfab2169eaed3b97890c82e684e8a1a1c3 (diff) | |
download | SoopyV2-aadc96313266643cc57e4e1d01112c41df0ac8a7.tar.gz SoopyV2-aadc96313266643cc57e4e1d01112c41df0ac8a7.tar.bz2 SoopyV2-aadc96313266643cc57e4e1d01112c41df0ac8a7.zip |
asd
Diffstat (limited to 'features/stat_next_to_name')
-rw-r--r-- | features/stat_next_to_name/index.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/features/stat_next_to_name/index.js b/features/stat_next_to_name/index.js index e534aba..46a7c8b 100644 --- a/features/stat_next_to_name/index.js +++ b/features/stat_next_to_name/index.js @@ -5,6 +5,8 @@ import soopyV2Server from "../../socketConnection"; import SettingBase from "../settings/settingThings/settingBase"; import * as numberUtils from "../../utils/numberUtils"; import DropdownSetting from "../settings/settingThings/dropdownSetting"; +import { fetch } from "../../utils/networkUtils" +import ToggleSetting from "../settings/settingThings/toggle"; class StatNextToName extends Feature { constructor() { @@ -39,15 +41,46 @@ class StatNextToName extends Feature { this.loadingStats = [] this.lastWorldLoad = undefined + this.apiKeyThing = new ToggleSetting("Use ur api key for data loading", "Max of 12 requests/min", true, "api_key_stat_load", this) soopyV2Server.onPlayerStatsLoaded = (stats) => { this.playerStatsLoaded.call(this, stats) } + soopyV2Server.apithingo = (uuid, packetId) => { + let key = this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue() + if (!key) return + + fetch(`https://api.hypixel.net/skyblock/profiles?key=${key}&uuid=${uuid}`).text(t => { + soopyV2Server.respondQueue(packetId, t) + }) + } + this.registerStep(false, 5, this.loadPlayerStatsTick) this.registerEvent("worldLoad", this.worldLoad) this.registerEvent("playerJoined", this.playerJoined) this.worldLoad() + + + // respondQueue(id, data) { + // this.sendData({ + // type: "api", + // id, + // data + // }) + // } + + this.registerStep(false, 5, () => { + if (keyValid && this.apiKeyThing.getValue()) soopyV2Server.joinApiQ() + }) + + let keyValid = false + let key = this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue() + fetch("https://api.hypixel.net/key?key=" + key).json(d => { + if (d.success) { + keyValid = true + } + }) } loadPlayerStatsTick() { |