diff options
author | Obsidian <108832807+Obsidianninja11@users.noreply.github.com> | 2024-03-04 10:59:15 -0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 20:59:15 +0100 |
commit | 16facf4a91651c709e4c78e7b3f2c9973560feab (patch) | |
tree | a906f9ca75bee7296158c07399348952b1e9ec71 /src/main/java/at/hannibal2/skyhanni/features | |
parent | e52c3015102bc308f3536c377eb56d99d8f83b20 (diff) | |
download | skyhanni-16facf4a91651c709e4c78e7b3f2c9973560feab.tar.gz skyhanni-16facf4a91651c709e4c78e7b3f2c9973560feab.tar.bz2 skyhanni-16facf4a91651c709e4c78e7b3f2c9973560feab.zip |
Feature: Added option to show some features outside SB. (#603)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
14 files changed, 87 insertions, 60 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt index 482799d27..90ec54196 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.cosmetics import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -30,8 +31,7 @@ class ArrowTrail { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!isEnabled()) return val secondsAlive = config.secondsAlive.toDouble().toDuration(DurationUnit.SECONDS) val time = SimpleTimeMark.now() val deathTime = time.plus(secondsAlive) @@ -51,8 +51,7 @@ class ArrowTrail { @SubscribeEvent fun onWorldRender(event: LorenzRenderWorldEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!isEnabled()) return val color = if (config.handlePlayerArrowsDifferently) config.playerArrowColor else config.arrowColor val playerArrowColor = color.toChromaColor() listYourArrow.forEach { @@ -66,6 +65,8 @@ class ArrowTrail { } } + private fun isEnabled() = config.enabled && (LorenzUtils.inSkyBlock || OutsideSbFeature.ARROW_TRAIL.isSelected()) + @SubscribeEvent fun onIslandChange(event: IslandChangeEvent) { listAllArrow.clear() diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index 7f617fc64..1515e9a11 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.cosmetics import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -35,8 +36,7 @@ class CosmeticFollowingLine { @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!isEnabled()) return updateClose(event) @@ -99,8 +99,7 @@ class CosmeticFollowingLine { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!isEnabled()) return if (event.isMod(5)) { locations = locations.editCopy { values.removeIf { it.time.passedSince() > config.secondsAlive.seconds } } @@ -124,6 +123,8 @@ class CosmeticFollowingLine { } } + private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.FOLLOWING_LINE.isSelected()) && config.enabled + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "misc.cosmeticConfig", "misc.cosmetic") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 8b38e801b..b114d5ab4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.config.features.garden.NextJacobContestConfig.ShareContestsEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.DebugDataCollectEvent @@ -512,8 +513,9 @@ object GardenNextJacobContest { } } - private fun isEnabled() = LorenzUtils.inSkyBlock && config.display - && (GardenAPI.inGarden() || config.everywhere) + private fun isEnabled() = + config.display && ((LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden)) || + (OutsideSbFeature.NEXT_JACOB_CONTEXT.isSelected() && !LorenzUtils.inSkyBlock)) private fun isFetchEnabled() = isEnabled() && config.fetchAutomatically private fun isSendEnabled() = @@ -642,6 +644,7 @@ object GardenNextJacobContest { event.transform(15, "garden.nextJacobContests.shareAutomatically") { element -> ConfigUtils.migrateIntToEnum(element, ShareContestsEntry::class.java) } + event.move(18, "garden.nextJacobContests.everywhere", "garden.nextJacobContests.showOutsideGarden") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt index e93d7ce67..32f4cafdf 100755 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt @@ -1,5 +1,7 @@ package at.hannibal2.skyhanni.features.garden +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils @@ -19,10 +21,9 @@ class GardenYawAndPitch { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!LorenzUtils.onHypixel) return + if (!isEnabled()) return if (GardenAPI.hideExtraGuis()) return - if (!GardenAPI.inGarden() && !config.showEverywhere) return if (GardenAPI.toolInHand == null && !config.showWithoutTool) return val player = Minecraft.getMinecraft().thePlayer @@ -57,4 +58,13 @@ class GardenYawAndPitch { fun onGardenToolChange(event: GardenToolChangeEvent) { lastChange = SimpleTimeMark.farPast() } + + private fun isEnabled() = + config.enabled && ((OutsideSbFeature.YAW_AND_PITCH.isSelected() && !LorenzUtils.inSkyBlock) || + (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))) + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(18, "garden.yawPitchDisplay.showEverywhere", "garden.yawPitchDisplay.showOutsideGarden") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index e55bbb833..c7a6b8f8b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils @@ -8,7 +9,8 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.TimeUtils @@ -25,6 +27,7 @@ class ComposterDisplay { private var display = emptyList<List<Any>>() private var composterEmptyTime: Duration? = null + private val bucket by lazy { "BUCKET".asInternalName().getItemStack() } private var tabListData by ComposterAPI::tabListData enum class DataType(rawPattern: String, val icon: String) { @@ -33,9 +36,7 @@ class ComposterDisplay { TIME_LEFT(" Time Left: §r(.*)", "WATCH"), STORED_COMPOST(" Stored Compost: §r(.*)", "COMPOST"); - val displayItem by lazy { - NEUItems.getItemStack(icon) - } + val displayItem by lazy { icon.asInternalName().getItemStack() } val pattern by lazy { rawPattern.toPattern() } @@ -80,7 +81,7 @@ class ComposterDisplay { return if (emptyTime != null) { GardenAPI.storage?.composterEmptyTime = System.currentTimeMillis() + emptyTime.inWholeMilliseconds val format = emptyTime.format() - listOf(NEUItems.getItemStack("BUCKET"), "§b$format") + listOf(bucket, "§b$format") } else { listOf("§cOpen Composter Upgrades!") } @@ -142,7 +143,7 @@ class ComposterDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.COMPOSTER_TIME.isSelected()) return if (GardenAPI.inGarden() && config.displayEnabled) { config.displayPos.renderStringsAndItems(display, posLabel = "Composter Display") @@ -152,23 +153,25 @@ class ComposterDisplay { } private fun checkWarningsAndOutsideGarden() { - val storage = GardenAPI.storage ?: return - - val format = if (storage.composterEmptyTime != 0L) { - val duration = storage.composterEmptyTime - System.currentTimeMillis() - if (duration > 0) { - if (duration < 1000 * 60 * 20) { - warn("Your composter in the garden is soon empty!") + val format = GardenAPI.storage?.let { + if (it.composterEmptyTime != 0L) { + val duration = it.composterEmptyTime - System.currentTimeMillis() + if (duration > 0) { + if (duration < 1000 * 60 * 20) { + warn("Your composter in the garden is almost empty!") + } + TimeUtils.formatDuration(duration, maxUnits = 3) + } else { + warn("Your composter is empty!") + "§cComposter is empty!" } - TimeUtils.formatDuration(duration, maxUnits = 3) - } else { - warn("Your composter is empty!") - "§cComposter is empty!" - } - } else "?" + } else "?" + } ?: "§cJoin SkyBlock to show composter timer." - if (!GardenAPI.inGarden() && config.displayOutsideGarden) { - val list = Collections.singletonList(listOf(NEUItems.getItemStack("BUCKET"), "§b$format")) + val inSb = LorenzUtils.inSkyBlock && config.displayOutsideGarden + val outsideSb = !LorenzUtils.inSkyBlock && OutsideSbFeature.COMPOSTER_TIME.isSelected() + if (!GardenAPI.inGarden() && (inSb || outsideSb)) { + val list = Collections.singletonList(listOf(bucket, "§b$format")) config.outsideGardenPos.renderStringsAndItems(list, posLabel = "Composter Outside Garden Display") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index ebf444535..6baa0970f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.jsonobjects.other.EliteLeaderboardJson @@ -144,7 +145,7 @@ class FarmingWeightDisplay { private var lastOpenWebsite = SimpleTimeMark.farPast() private fun update() { - if (!GardenAPI.inGarden()) return + if (!isEnabled()) return if (apiError) { display = errorMessage return @@ -153,10 +154,6 @@ class FarmingWeightDisplay { if (weight == -1.0) { if (!isLoadingWeight) { val localProfile = HypixelData.profileName - if (localProfile == "") { - display = Renderable.singeltonString("§cError: profileName is empty!") - return - } isLoadingWeight = true if (display.isEmpty()) { @@ -338,7 +335,9 @@ class FarmingWeightDisplay { ) } - private fun isEnabled() = GardenAPI.inGarden() && config.display + private fun isEnabled() = ((OutsideSbFeature.FARMING_WEIGHT.isSelected() && !LorenzUtils.inSkyBlock) || + (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))) && config.display + private fun isEtaEnabled() = config.overtakeETA fun addCrop(crop: CropType, addedCounter: Int) { @@ -452,7 +451,7 @@ class FarmingWeightDisplay { val selectedProfileId = apiData.selectedProfileId var selectedProfileEntry = apiData.profiles.find { it.profileId == selectedProfileId } - if (selectedProfileEntry == null || selectedProfileEntry.profileName.lowercase() != localProfile) { + if (selectedProfileEntry == null || (selectedProfileEntry.profileName.lowercase() != localProfile && localProfile != "")) { selectedProfileEntry = apiData.profiles.find { it.profileName.lowercase() == localProfile } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt index a2369fc38..cfecac7e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange @@ -27,22 +28,22 @@ class CustomTextBox { @SubscribeEvent fun onRenderGUIOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { - if (!config.enabled) return if (!config.onlyInGUI) return - if (!LorenzUtils.inSkyBlock) return + if (!isEnabled()) return config.position.renderStrings(display, posLabel = "Custom Text Box") } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!config.enabled) return if (config.onlyInGUI) return - if (!LorenzUtils.inSkyBlock) return + if (!isEnabled()) return config.position.renderStrings(display, posLabel = "Custom Text Box") } + private fun isEnabled() = config.enabled && (LorenzUtils.inSkyBlock || OutsideSbFeature.CUSTOM_TEXT_BOX.isSelected()) + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.textBox", "gui.customTextBox") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt index ee8f2c37c..8d647c9d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -15,7 +16,6 @@ import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class MarkedPlayerManager { - private val config get() = SkyHanniMod.feature.markedPlayers companion object { @@ -79,7 +79,7 @@ class MarkedPlayerManager { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!isEnabled()) return if (event.repeatSeconds(1)) { findPlayers() @@ -106,6 +106,8 @@ class MarkedPlayerManager { } } + private fun isEnabled() = config.highlightInWorld && (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected()) + @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { if (Minecraft.getMinecraft().thePlayer == null) return @@ -118,6 +120,4 @@ class MarkedPlayerManager { } } } - - private fun isEnabled() = LorenzUtils.inSkyBlock && config.highlightInWorld } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt index dbf76a3dc..0af985c67 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round @@ -41,5 +42,7 @@ class MovementSpeedDisplay { config.playerMovementSpeedPos.renderString(display, posLabel = "Movement Speed") } - fun isEnabled() = LorenzUtils.inSkyBlock && config.playerMovementSpeed + fun isEnabled() = LorenzUtils.onHypixel && + (LorenzUtils.inSkyBlock || OutsideSbFeature.MOVEMENT_SPEED.isSelected()) && + config.playerMovementSpeed } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt index 6de5b8cf7..e90265ef3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.enums.OutsideSbFeature
import at.hannibal2.skyhanni.data.PartyAPI
import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -20,7 +21,8 @@ class PartyMemberOutlines { }
}
- private fun isEnabled() = LorenzUtils.inSkyBlock && !LorenzUtils.inDungeons && config.enabled
+ fun isEnabled() = config.enabled &&
+ (LorenzUtils.inSkyBlock || OutsideSbFeature.HIGHLIGHT_PARTY_MEMBERS.isSelected()) && !LorenzUtils.inDungeons
private fun getEntityOutlineColor(entity: Entity): Int? {
if (entity !is EntityOtherPlayerMP || !PartyAPI.partyMembers.contains(entity.name)) return null
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index 2d241dd9c..a0ce295b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.jsonobjects.repo.ModGuiSwitcherJson +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager @@ -192,7 +193,7 @@ object QuickModMenuSwitch { GlStateManager.popMatrix() } - fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled + fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.QUICK_MOD_MENU_SWITCH.isSelected()) && config.enabled @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index 9c71d3153..edcfec79f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.WinterAPI import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -31,7 +32,7 @@ class TimeFeatures { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.REAL_TIME.isSelected()) return if (config.realTime) { val currentTime = diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 7e70c1c06..92620bf49 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent @@ -31,8 +32,7 @@ class TpsCounter { init { fixedRateTimer(name = "skyhanni-tps-counter-seconds", period = 1000L) { - if (!LorenzUtils.inSkyBlock) return@fixedRateTimer - if (!config.tpsDisplay) return@fixedRateTimer + if (!isEnabled()) return@fixedRateTimer if (packetsFromLastSecond == 0) return@fixedRateTimer if (ignoreFirstTicks > 0) { @@ -61,8 +61,7 @@ class TpsCounter { } } fixedRateTimer(name = "skyhanni-tps-counter-ticks", period = 50L) { - if (!LorenzUtils.inSkyBlock) return@fixedRateTimer - if (!config.tpsDisplay) return@fixedRateTimer + if (!isEnabled()) return@fixedRateTimer if (hasPacketReceived) { hasPacketReceived = false @@ -87,12 +86,14 @@ class TpsCounter { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.tpsDisplay) return + if (!isEnabled()) return config.tpsDisplayPosition.renderString(display, posLabel = "Tps Display") } + private fun isEnabled() = LorenzUtils.onHypixel && config.tpsDisplay && + (LorenzUtils.inSkyBlock || OutsideSbFeature.TPS_DISPLAY.isSelected()) + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.tpsDisplayEnabled", "gui.tpsDisplay") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt index d250311db..9198438aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.visualwords import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.convertToFormatted import at.hannibal2.skyhanni.utils.TimeLimitedCache @@ -17,7 +18,7 @@ object ModifyVisualWords { var modifiedText = originalText ?: return null if (!LorenzUtils.onHypixel) return originalText if (!config.enabled) return originalText - if (!LorenzUtils.inSkyBlock && !config.workOutside) return originalText + if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.MODIFY_VISUAL_WORDS.isSelected()) return originalText if (modifiedWords.isEmpty()) { modifiedWords = SkyHanniMod.feature.storage.modifiedWords |