diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-14 01:20:42 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-14 01:20:42 +0100 |
commit | ad991c1d7ef55e10755fb75a1bd44314a19a3739 (patch) | |
tree | 8bd357983eb27aaf6197aebb7267bbb1595e1d34 /src/main/java/at/hannibal2/skyhanni | |
parent | db34c26f1838a06f0516e2a57c61964f64f1f758 (diff) | |
download | skyhanni-ad991c1d7ef55e10755fb75a1bd44314a19a3739.tar.gz skyhanni-ad991c1d7ef55e10755fb75a1bd44314a19a3739.tar.bz2 skyhanni-ad991c1d7ef55e10755fb75a1bd44314a19a3739.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
2 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/itemability/ItemAbilityConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/itemability/ItemAbilityConfig.java index dabb0d535..304648b35 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/itemability/ItemAbilityConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/itemability/ItemAbilityConfig.java @@ -12,6 +12,7 @@ public class ItemAbilityConfig { @ConfigOption(name = "Ability Cooldown", desc = "Show the cooldown of item abilities.") @ConfigEditorBoolean @FeatureToggle + // TODO rename to "enabled" public boolean itemAbilityCooldown = false; @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index dd1c1fedf..237fca803 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -31,6 +31,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.max class ItemAbilityCooldown { + private val config get() = SkyHanniMod.feature.itemAbilities + private var lastAbility = "" private var items = mapOf<ItemStack, List<ItemText>>() private var abilityItems = mapOf<ItemStack, MutableList<ItemAbility>>() @@ -215,9 +217,7 @@ class ItemAbilityCooldown { lastAbility = "" } - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.itemAbilities.itemAbilityCooldown - } + private fun isEnabled(): Boolean = LorenzUtils.inSkyBlock && config.itemAbilityCooldown private fun click(ability: ItemAbility) { if (ability.actionBarDetection) { @@ -242,7 +242,7 @@ class ItemAbilityCooldown { private fun createItemText(ability: ItemAbility): ItemText { val specialColor = ability.specialColor - val readyText = if (SkyHanniMod.feature.itemAbilities.itemAbilityShowWhenReady) "R" else "" + val readyText = if (config.itemAbilityShowWhenReady) "R" else "" return if (ability.isOnCooldown()) { val duration: Long = ability.lastActivation + ability.getCooldown() - System.currentTimeMillis() val color = specialColor ?: if (duration < 600) LorenzColor.RED else LorenzColor.YELLOW @@ -288,11 +288,11 @@ class ItemAbilityCooldown { event.renderObjects.add(renderObject) // fix multiple problems when having multiple abilities - if (SkyHanniMod.feature.itemAbilities.itemAbilityCooldownBackground) { + if (config.itemAbilityCooldownBackground) { var opacity = 130 if (color == LorenzColor.GREEN) { opacity = 80 - if (!SkyHanniMod.feature.itemAbilities.itemAbilityShowWhenReady) return + if (!config.itemAbilityShowWhenReady) return } stack.background = color.addOpacity(opacity).rgb } |