From a5592334e016b6071ac79262c8ec8bcbcaa63a32 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 22 Sep 2022 11:20:21 +0800 Subject: + bestiary update thing + misc fixes --- src/features/stat_next_to_name/index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/features/stat_next_to_name') 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() { -- cgit