diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-22 11:20:21 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-22 11:20:21 +0800 |
commit | a5592334e016b6071ac79262c8ec8bcbcaa63a32 (patch) | |
tree | ccf98758001ea6a0336e864682b74a785d386a8c /src/features/stat_next_to_name | |
parent | f3fdefe9e5e58f23e2ee8e14d6d77d056e09cedd (diff) | |
download | SoopyV2-a5592334e016b6071ac79262c8ec8bcbcaa63a32.tar.gz SoopyV2-a5592334e016b6071ac79262c8ec8bcbcaa63a32.tar.bz2 SoopyV2-a5592334e016b6071ac79262c8ec8bcbcaa63a32.zip |
+ bestiary update thing
+ misc fixes
Diffstat (limited to 'src/features/stat_next_to_name')
-rw-r--r-- | src/features/stat_next_to_name/index.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/features/stat_next_to_name/index.js b/src/features/stat_next_to_name/index.js index 2045db5..3845b66 100644 --- a/src/features/stat_next_to_name/index.js +++ b/src/features/stat_next_to_name/index.js @@ -6,6 +6,7 @@ import SettingBase from "../settings/settingThings/settingBase"; import * as numberUtils from "../../utils/numberUtils"; import DropdownSetting from "../settings/settingThings/dropdownSetting"; import ToggleSetting from "../settings/settingThings/toggle"; +import NonPooledThread from "../../utils/nonPooledThread"; class StatNextToName extends Feature { constructor() { @@ -73,12 +74,19 @@ class StatNextToName extends Feature { }) let keyValid = false - let key = this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue() - fetch("https://api.hypixel.net/key?key=" + key).json().then(d => { - if (d.success) { - keyValid = true + let key = undefined + new NonPooledThread(() => { + while (!this.FeatureManager.features["globalSettings"]?.class) { + Thread.sleep(1000) } - }) + + key = this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue() + fetch("https://api.hypixel.net/key?key=" + key).json().then(d => { + if (d.success) { + keyValid = true + } + }) + }).start() } loadPlayerStatsTick() { |