Skip to content

Commit

Permalink
chore: remove deprecated choices value usages (#5134)
Browse files Browse the repository at this point in the history
* chore: remove deprecated choices value usages

* fix val
  • Loading branch information
MukjepScarlet authored Jan 1, 2025
1 parent f4d2fa9 commit 9c0e90c
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,7 @@ open class Configurable(
}
}

@Deprecated(
"Use choices(listenable, name, activeIndex, choicesCallback) instead",
ReplaceWith("choices(listenable, name, activeIndex, choicesCallback)")
)
fun <T : Choice> choices(
protected fun <T : Choice> choices(
eventListener: EventListener,
name: String,
activeCallback: (ChoiceConfigurable<T>) -> T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ open class ClientModule(
name: String,
activeIndex: Int,
choicesCallback: (ChoiceConfigurable<T>) -> Array<T>
) = choices(this, name, { it.choices[activeIndex] }, choicesCallback)
) = choices(this, name, activeIndex, choicesCallback)

fun message(key: String, vararg args: Any) = translation("$baseKey.messages.$key", *args)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import net.ccbluex.liquidbounce.features.module.Category
import net.ccbluex.liquidbounce.features.module.ClientModule
import net.ccbluex.liquidbounce.render.renderEnvironmentForWorld
import net.ccbluex.liquidbounce.utils.aiming.*
import net.ccbluex.liquidbounce.utils.aiming.anglesmooth.AngleSmoothMode
import net.ccbluex.liquidbounce.utils.aiming.anglesmooth.LinearAngleSmoothMode
import net.ccbluex.liquidbounce.utils.aiming.anglesmooth.SigmoidAngleSmoothMode
import net.ccbluex.liquidbounce.utils.client.Chronometer
Expand Down Expand Up @@ -62,14 +61,11 @@ object ModuleAimbot : ClientModule("Aimbot", Category.COMBAT, aliases = arrayOf(
private val pointTracker = tree(PointTracker())
private val clickTimer = Chronometer()

private var angleSmooth = choices<AngleSmoothMode>(this, "AngleSmooth", { it.choices[0] }, {
arrayOf(
LinearAngleSmoothMode(it),
SigmoidAngleSmoothMode(it)
)
})
private val angleSmooth = choices("AngleSmooth", 0) {
arrayOf(LinearAngleSmoothMode(it), SigmoidAngleSmoothMode(it))
}

private var slowStart = tree(SlowStart(this))
private val slowStart = tree(SlowStart(this))

private var targetRotation: Rotation? = null
private var playerRotation: Rotation? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ object ModuleCrystalAura : ClientModule(

private val targetRenderer = tree(WorldTargetRenderer(this))

val rotationMode = choices<RotationMode>(this, "RotationMode", { it.choices[0] }, {
val rotationMode = choices("RotationMode", 0) {
arrayOf(NormalRotationMode(it, this, Priority.NORMAL), NoRotationMode(it, this))
})
}

var currentTarget: LivingEntity? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ abstract class PredictFeature(name: String) : ToggleableConfigurable(ModuleCryst
/**
* How the predicted data will be used. For damage prediction only.
*/
val calculationMode = choices<CalculationMode>(this, "CalculationMode", { it.choices[0] }, {
val calculationMode = choices(this, "CalculationMode", 0) {
arrayOf(Both(it), PredictOnly(it))
})
}

/**
* Check if the target will block the placement.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package net.ccbluex.liquidbounce.features.module.modules.combat.killaura.features

import net.ccbluex.liquidbounce.config.types.Choice
import net.ccbluex.liquidbounce.config.types.NoneChoice
import net.ccbluex.liquidbounce.config.types.ToggleableConfigurable
import net.ccbluex.liquidbounce.event.Sequence
Expand All @@ -44,9 +43,9 @@ internal object KillAuraFailSwing : ToggleableConfigurable(ModuleKillAura, "Fail
*/
val additionalRange by float("AdditionalRange", 2f, 0f..10f)
val clickScheduler = tree(ClickScheduler(this, false))
val mode = choices<Choice>(this, "NotifyWhenFail", { Box }, {
val mode = choices(this, "NotifyWhenFail", 1) {
arrayOf(NoneChoice(it), Box, Sound)
}).apply {
}.apply {
doNotIncludeAlways()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package net.ccbluex.liquidbounce.features.module.modules.movement.noslow.modes.sneaking

import net.ccbluex.liquidbounce.config.types.Choice
import net.ccbluex.liquidbounce.config.types.NoneChoice
import net.ccbluex.liquidbounce.config.types.ToggleableConfigurable
import net.ccbluex.liquidbounce.event.events.PlayerSneakMultiplier
Expand All @@ -32,7 +31,7 @@ internal object NoSlowSneaking : ToggleableConfigurable(ModuleNoSlow, "Sneaking"
private val minMultiplier by float("MinMultiplier", 1f, 0.3f..1f)

@Suppress("unused")
private val modes = choices<Choice>(this, "Mode", { it.choices[0] }) {
private val modes = choices(this, "Mode", 0) {
arrayOf(
NoneChoice(it),
NoSlowSneakingSwitch(it),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ object ModuleSpeed : ClientModule("Speed", Category.MOVEMENT) {

private object OnlyInCombat : ToggleableConfigurable(this, "OnlyInCombat", false) {

val modes = choices(this, "Mode", { it.choices[0] },
ModuleSpeed::initializeSpeeds)
val modes = choices(this, "Mode", 0, ModuleSpeed::initializeSpeeds)

/**
* Controls [modes] activation state.
Expand All @@ -162,8 +161,7 @@ object ModuleSpeed : ClientModule("Speed", Category.MOVEMENT) {
arrayOf(SpeedPotionEffectChoice, SlownessPotionEffectChoice, BothEffectsChoice)
)

val modes = choices(this, "Mode", { it.choices[0] },
ModuleSpeed::initializeSpeeds)
val modes = choices(this, "Mode", 0, ModuleSpeed::initializeSpeeds)

/**
* Controls [modes] activation state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ open class RotationsConfigurable(
combatSpecific: Boolean = false
) : Configurable("Rotations") {

var angleSmooth = choices<AngleSmoothMode>(owner, "AngleSmooth", { it.choices[0] }, {
val angleSmooth = choices(owner, "AngleSmooth", 0) {
arrayOf(
LinearAngleSmoothMode(it),
BezierAngleSmoothMode(it),
SigmoidAngleSmoothMode(it),
ConditionalLinearAngleSmoothMode(it),
AccelerationSmoothMode(it)
)
})
}

private var slowStart = SlowStart(owner).takeIf { combatSpecific }?.also { tree(it) }
private var shortStop = ShortStop(owner).takeIf { combatSpecific }?.also { tree(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class CrystalDestroyFeature(eventListener: EventListener, private val module: Cl
private val delay by int("Delay", 0, 0..1000, "ms")
private val swing by boolean("Swing", true)

val rotationMode = choices<RotationMode>(this, "RotationMode", { it.choices[0] }, {
val rotationMode = choices(this, "RotationMode", 0) {
arrayOf(NormalRotationMode(it, module, Priority.IMPORTANT_FOR_USAGE_3), NoRotationMode(it, module))
})
}

private val chronometer = Chronometer()

Expand Down

0 comments on commit 9c0e90c

Please sign in to comment.