diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/featureClass/class.js | 5 | ||||
-rw-r--r-- | src/featureClass/featureManager.js | 11 | ||||
-rw-r--r-- | src/features/betterGuis/index.js | 6 | ||||
-rw-r--r-- | src/features/cosmetics/cosmetic/dragon/dragonWings.js | 9 | ||||
-rw-r--r-- | src/features/dungeonSolvers/index.js | 4 | ||||
-rw-r--r-- | src/features/globalSettings/index.js | 84 | ||||
-rw-r--r-- | src/features/hud/index.js | 4 | ||||
-rw-r--r-- | src/features/specialMining/index.js | 5 |
8 files changed, 24 insertions, 104 deletions
diff --git a/src/featureClass/class.js b/src/featureClass/class.js index 987b460..fc4f7ff 100644 --- a/src/featureClass/class.js +++ b/src/featureClass/class.js @@ -176,6 +176,8 @@ class Event { this.registerArgs = registerArgs this.parent = parent + this.data.eventT = this + this.enabled = true this.when = undefined @@ -280,14 +282,17 @@ class ForgeEvent extends Event { } class CustomEvent extends Event { + //theEvent, theEvent.trigger, [isFps, interval, func], this constructor(...args) { super(...args) } actuallyRegister() { + if (this.data.type === "step") return this.trigger.register() } actuallyUnregister() { + if (this.data.type === "step") return this.trigger.unregister() } } diff --git a/src/featureClass/featureManager.js b/src/featureClass/featureManager.js index 6974f46..eb2f0f9 100644 --- a/src/featureClass/featureManager.js +++ b/src/featureClass/featureManager.js @@ -19,7 +19,7 @@ let CTRequire = new JSLoader.CTRequire(StrongCachingModuleScriptProvider) const System = Java.type("java.lang.System") let loadedModules = new Set() -let shouldRequireForceNoCache = true +let shouldRequireForceNoCache = false function RequireNoCache(place) { if (!shouldRequireForceNoCache) { @@ -566,10 +566,12 @@ class FeatureManager { if (!func) throw new Error("Function must not be null") this.customEvents[id] = { - func: func, - context: context, + func, + context, trigger: register(type, (...args) => { try { + if (this.customEvents[id]?.eventT && !this.customEvents[id].eventT.enabled) return + if (context.enabled) { if (this.recordingPerformanceUsage) this.startRecordingPerformance(context.getId(), type) let start = Date.now() @@ -587,7 +589,8 @@ class FeatureManager { soopyV2Server.reportError(e, "Error in " + type + " event.") } }), - id: id + id, + type, } return this.customEvents[id] diff --git a/src/features/betterGuis/index.js b/src/features/betterGuis/index.js index dcd8fb9..d125a2f 100644 --- a/src/features/betterGuis/index.js +++ b/src/features/betterGuis/index.js @@ -297,15 +297,15 @@ class BetterGuis extends Feature { return; } if (this.lastWindowId === 0) { - this.lastWindowId = Player.getContainer().getWindowId(); + this.lastWindowId = Player.getContainer()?.getWindowId(); return; } - if (Player.getContainer().getWindowId() === this.lastWindowId) { + if (Player.getContainer()?.getWindowId() === this.lastWindowId) { this.shouldHold-- return; } - this.lastWindowId = Player.getContainer().getWindowId(); + this.lastWindowId = Player.getContainer()?.getWindowId(); this.shouldHold += 10; if (Date.now() - this.clickSlotTime > 1000) { this.clickSlot = -1; diff --git a/src/features/cosmetics/cosmetic/dragon/dragonWings.js b/src/features/cosmetics/cosmetic/dragon/dragonWings.js index fbe67e4..ef34cd9 100644 --- a/src/features/cosmetics/cosmetic/dragon/dragonWings.js +++ b/src/features/cosmetics/cosmetic/dragon/dragonWings.js @@ -472,11 +472,4 @@ function setField(e, field, value) { field2.setAccessible(true) return field2.set(e, value) -} - -let a = 0 - -register("command", (val) => { - a = parseFloat(val) - ChatLib.chat("Set a to " + a) -}).setName("seta", true)
\ No newline at end of file +}
\ No newline at end of file diff --git a/src/features/dungeonSolvers/index.js b/src/features/dungeonSolvers/index.js index 787879a..4472d95 100644 --- a/src/features/dungeonSolvers/index.js +++ b/src/features/dungeonSolvers/index.js @@ -1063,7 +1063,7 @@ class DungeonSolvers extends Feature { } addBlaze(blaze) { - if (!this.FeatureManager.features["dataLoader"].class.dungeonFloor) return; + if (!this.FeatureManager.features["dataLoader"] || !this.FeatureManager.features["dataLoader"].class.dungeonFloor) return; if (this.blazeX === -1) { this.blazes.push(blaze); let locs = {}; @@ -1141,7 +1141,7 @@ class DungeonSolvers extends Feature { if (end === "[✔]") this.completedPuzzleCount++; }); - if (this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")) { + if (this.FeatureManager.features["dataLoader"] && this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")) { let type = World.getBlockAt(3, 108, 30).getMetadata(); let typeReplace = { diff --git a/src/features/globalSettings/index.js b/src/features/globalSettings/index.js index 3e9ded1..896271b 100644 --- a/src/features/globalSettings/index.js +++ b/src/features/globalSettings/index.js @@ -483,6 +483,7 @@ class GlobalSettings extends Feature { let j = 0; let now = Date.now(); let thunderText = []; + if (!Player.getInventory()) return [...Player.getInventory().getItems()].forEach(i => { j++; if (i) { @@ -911,89 +912,6 @@ class GlobalSettings extends Feature { return false } } - findKey() { - new Notification("Finding key...", []) - new Thread(() => { - - // NEU - try { - let testKey = JSON.parse(new JavaString(Files.readAllBytes(Paths.get("./config/notenoughupdates/configNew.json")))).apiKey.apiKey - if (testKey) { - if (this.verifyKey(testKey)) { - this.apiKeySetting.setValue(testKey) - new Notification("§aSuccess!", ["Found api key in NotEnoughUpdates!"]) - return; - } else { - logger.logMessage("Found invalid key in NotEnoughUpdates", 3) - } - } - } catch (_) { } - - // SBE - try { - let testKey = JSON.parse(new JavaString(Files.readAllBytes(Paths.get("./config/SkyblockExtras.cfg")))).values.apiKey - if (testKey) { - if (this.verifyKey(testKey)) { - this.apiKeySetting.setValue(testKey) - new Notification("§aSuccess!", ["Found api key in SkyblockExtras!"]) - return; - } else { - logger.logMessage("Found invalid key in SkyblockExtras", 3) - } - } - } catch (_) { } - // SKYTILS - try { - let testKey2 = new JavaString(Files.readAllBytes(Paths.get("./config/skytils/config.toml"))) - let testKey = undefined - testKey2.split("\n").forEach(line => { - if (line.startsWith(" hypixel_api_key = \"")) { - testKey = line.split("\"")[1] - } - }) - if (testKey) { - if (this.verifyKey(testKey)) { - this.apiKeySetting.setValue(testKey) - new Notification("§aSuccess!", ["Found api key in Skytils!"]) - return; - } else { - logger.logMessage("Found invalid key in Skytils", 3) - } - } - } catch (_) { } - - // SOOPYADDONS DATA - try { - let testKey = FileLib.read("soopyAddonsData", "apikey.txt") - if (testKey) { - if (this.verifyKey(testKey)) { - this.apiKeySetting.setValue(testKey) - new Notification("§aSuccess!", ["Found api key in old soopyaddons version!"]) - return; - } else { - logger.logMessage("Found invalid key in soopyaddonsData", 3) - } - } - } catch (_) { } - - // HypixelApiKeyManager - try { - let testKey = JSON.parse(FileLib.read("HypixelApiKeyManager", "localdata.json")).key - if (testKey) { - if (this.verifyKey(testKey)) { - this.apiKeySetting.setValue(testKey) - new Notification("§aSuccess!", ["Found api key in HypixelApiKeyManager!"]) - return; - } else { - logger.logMessage("Found invalid key in HypixelApiKeyManager", 3) - } - } - } catch (_) { } - - - new Notification("§cUnable to find api key", []) - }).start() - } apiNewCommand() { ChatLib.command("api new") diff --git a/src/features/hud/index.js b/src/features/hud/index.js index bd211e6..81f9285 100644 --- a/src/features/hud/index.js +++ b/src/features/hud/index.js @@ -311,12 +311,12 @@ class Hud extends Feature { }) this.registerSoopy("apiLoad", this.apiLoad) - if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock) { + if (this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock, "skyblock", true, true) this.lastSwappedPet = Date.now() } - if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw) { + if (this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw, "skyblock", false, true) } diff --git a/src/features/specialMining/index.js b/src/features/specialMining/index.js index 8b13ac3..4c29acc 100644 --- a/src/features/specialMining/index.js +++ b/src/features/specialMining/index.js @@ -21,10 +21,11 @@ class PowderAndScatha extends Feature { this.compactedChat = new ToggleSetting("Compact Powder Messages", "same as the one in skytils but support following setting", false, "compact_powder_chat", this) this.fixChatForDoublePowder = new ToggleSetting("Fix Chat Messages During Double Powder", "so it's the correct amount of powder you received during the event", false, "fix_chat_dpowder", this) this.fixChatForDoublePowderSuffix = new TextSetting("Suffix of previous message", "(so you can tell whether it's 2x powder) change it yourself!", "&a(&b2X Powder&a)", "chat_dpowder_suffix", this, "(none)", false).requires(this.fixChatForDoublePowder); - this.PowderElement = new ToggleSetting("Powder Mining Info Hud (MAIN TOGGLE)", "This will show your current powder mining section (only in CH)", true, "powder_mining_hud", this).contributor("EmeraldMerchant"); + this.PowderElement = new ToggleSetting("Powder Mining Features (MAIN TOGGLE)", "", true, "powder_mining_hud", this).contributor("EmeraldMerchant"); + this.PowderHudElement = new ToggleSetting("Powder info on hud", "This will show your current powder mining section (only in CH)", true, "powder_gui_element", this).requires(this.PowderElement) this.PowderOverlayElement = new HudTextElement() .setText("") - .setToggleSetting(this.PowderElement) + .setToggleSetting(this.PowderHudElement) .setLocationSetting(new LocationSetting("Powder Mining Info Hud Location", "Allows you to edit the location of Powder Mining Info Hud", "powder_mining_hud_location", this, [10, 50, 1, 1]).requires(this.PowderElement).editTempText(`&b2x Powder: &cINACTIVE\n&aChests: &b32\n&bMithril: &d12,768\n&bGems: &d21,325`).contributor("EmeraldMerchant")); this.hudElements.push(this.PowderOverlayElement); this.PowderOverlayElement.disableRendering() |