Skip to content

Commit 9612507

Browse files
committed
cleanup
1 parent 1ee8441 commit 9612507

File tree

10 files changed

+12
-16
lines changed

10 files changed

+12
-16
lines changed

src/main/kotlin/com/lambda/config/groups/BreakSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BreakSettings(
3333
c: Configurable,
3434
baseGroup: NamedEnum,
3535
vis: () -> Boolean = { true },
36-
) : BreakConfig, SettingGroup(c, c.settings.size) {
36+
) : BreakConfig, SettingGroup(c) {
3737
enum class Group(override val displayName: String) : NamedEnum {
3838
General("General"),
3939
Cosmetic("Cosmetic")

src/main/kotlin/com/lambda/config/groups/BuildSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class BuildSettings(
2626
c: Configurable,
2727
vararg baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true },
29-
) : BuildConfig, SettingGroup(c, c.settings.size) {
29+
) : BuildConfig, SettingGroup(c) {
3030
enum class Group(override val displayName: String) : NamedEnum {
3131
General("General"),
3232
Reach("Reach"),

src/main/kotlin/com/lambda/config/groups/EatSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EatSettings(
2525
c: Configurable,
2626
baseGroup: NamedEnum,
2727
vis: () -> Boolean = { true }
28-
) : EatConfig, SettingGroup(c, c.settings.size) {
28+
) : EatConfig, SettingGroup(c) {
2929
val nutritiousFoodDefaults = listOf(Items.APPLE, Items.BAKED_POTATO, Items.BEEF, Items.BEETROOT, Items.BEETROOT_SOUP, Items.BREAD, Items.CARROT, Items.CHICKEN, Items.CHORUS_FRUIT, Items.COD, Items.COOKED_BEEF, Items.COOKED_CHICKEN, Items.COOKED_COD, Items.COOKED_MUTTON, Items.COOKED_PORKCHOP, Items.COOKED_RABBIT, Items.COOKED_SALMON, Items.COOKIE, Items.DRIED_KELP, Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_APPLE, Items.GOLDEN_CARROT, Items.HONEY_BOTTLE, Items.MELON_SLICE, Items.MUSHROOM_STEW, Items.MUTTON, Items.POISONOUS_POTATO, Items.PORKCHOP, Items.POTATO, Items.PUFFERFISH, Items.PUMPKIN_PIE, Items.RABBIT, Items.RABBIT_STEW, Items.ROTTEN_FLESH, Items.SALMON, Items.SPIDER_EYE, Items.SUSPICIOUS_STEW, Items.SWEET_BERRIES, Items.GLOW_BERRIES, Items.TROPICAL_FISH)
3030
val resistanceFoodDefaults = listOf(Items.ENCHANTED_GOLDEN_APPLE)
3131
val regenerationFoodDefaults = listOf(Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_APPLE)

src/main/kotlin/com/lambda/config/groups/HotbarSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class HotbarSettings(
2626
c: Configurable,
2727
baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true }
29-
) : HotbarConfig, SettingGroup(c, c.settings.size) {
29+
) : HotbarConfig, SettingGroup(c) {
3030
override val keepTicks by c.setting("Keep Ticks", 1, 0..20, 1, "The number of ticks to keep the current hotbar selection active", " ticks", visibility = vis).group(baseGroup)
3131
override val swapDelay by c.setting("Swap Delay", 0, 0..3, 1, "The number of ticks delay before allowing another hotbar selection swap", " ticks", visibility = vis).group(baseGroup)
3232
override val swapsPerTick by c.setting("Swaps Per Tick", 3, 1..10, 1, "The number of hotbar selection swaps that can take place each tick") { swapDelay <= 0 && vis() }.group(baseGroup)

src/main/kotlin/com/lambda/config/groups/InteractSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class InteractSettings(
2626
c: Configurable,
2727
baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true }
29-
) : InteractConfig, SettingGroup(c, c.settings.size) {
29+
) : InteractConfig, SettingGroup(c) {
3030
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting", visibility = vis).group(baseGroup)
3131
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting", visibility = vis).group(baseGroup)
3232
override val interactStageMask by c.setting("Interact Stage Mask", setOf(TickEvent.Input.Post), description = "The sub-tick timing at which interact actions are performed", visibility = vis).group(baseGroup)

src/main/kotlin/com/lambda/config/groups/InventorySettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class InventorySettings(
2626
c: Configurable,
2727
baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true }
29-
) : InventoryConfig, SettingGroup(c, c.settings.size) {
29+
) : InventoryConfig, SettingGroup(c) {
3030
enum class Group(override val displayName: String) : NamedEnum {
3131
Container("Container"),
3232
Access("Access")

src/main/kotlin/com/lambda/config/groups/PlaceSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PlaceSettings(
2828
c: Configurable,
2929
baseGroup: NamedEnum,
3030
vis: () -> Boolean = { true }
31-
) : PlaceConfig, SettingGroup(c, c.settings.size) {
31+
) : PlaceConfig, SettingGroup(c) {
3232
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", visibility = vis).group(baseGroup)
3333
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces", visibility = vis).group(baseGroup)
3434
override val axisRotateSetting by c.setting("Axis Rotate", true, "Overrides the Rotate For Place setting and rotates the player on each axis to air place rotational blocks") { vis() && airPlace.isEnabled }.group(baseGroup)

src/main/kotlin/com/lambda/config/groups/RotationSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class RotationSettings(
3232
c: Configurable,
3333
baseGroup: NamedEnum? = null,
3434
vis: () -> Boolean = { true }
35-
) : RotationConfig, SettingGroup(c, c.settings.size) {
35+
) : RotationConfig, SettingGroup(c) {
3636
override var rotationMode by c.setting("Mode", RotationMode.Sync, "How the player is being rotated on interaction", vis).group(baseGroup)
3737

3838
/** How many ticks to keep the rotation before resetting */

src/main/kotlin/com/lambda/config/groups/SettingGroup.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private val KProperty0<*>.delegate
3131
}
3232

3333
@Suppress("unchecked_cast")
34-
abstract class SettingGroup(val c: Configurable, val startIndex: Int) {
34+
abstract class SettingGroup(val c: Configurable) {
3535
@DslMarker
3636
annotation class SettingEditorDsl
3737

@@ -54,14 +54,14 @@ abstract class SettingGroup(val c: Configurable, val startIndex: Int) {
5454
fun edit(
5555
vararg settings: KProperty0<*>,
5656
edits: BasicEditBuilder.() -> Unit
57-
) { BasicEditBuilder(settings.toSet() as Set<AbstractSetting<*>>).apply(edits) }
57+
) { BasicEditBuilder(settings.map { it.delegate } as List<AbstractSetting<*>>).apply(edits) }
5858

5959
@SettingEditorDsl
6060
fun editWith(
6161
vararg settings: KProperty0<*>,
6262
other: KProperty0<*>,
6363
edits: BasicEditBuilder.(AbstractSetting<*>) -> Unit
64-
) { BasicEditBuilder(settings.toSet() as Set<AbstractSetting<*>>).edits(other.delegate as AbstractSetting<*>) }
64+
) { BasicEditBuilder(settings.map { it.delegate } as List<AbstractSetting<*>>).edits(other.delegate as AbstractSetting<*>) }
6565

6666
@SettingEditorDsl
6767
internal inline fun <T : Any> editTyped(
@@ -80,10 +80,6 @@ abstract class SettingGroup(val c: Configurable, val startIndex: Int) {
8080
fun hide(vararg settings: KProperty0<*>) =
8181
(settings.map { it.delegate } as List<AbstractSetting<*>>).forEach { it.hidden = true }
8282

83-
@SettingEditorDsl
84-
fun hideAll() =
85-
c.settings.listIterator(startIndex).forEach { it.hidden = true }
86-
8783
@SettingEditorDsl
8884
fun KProperty0<*>.insert(insert: KProperty0<*>, insertMode: InsertMode) {
8985
val delegate = insert.delegate as AbstractSetting<*>

src/main/kotlin/com/lambda/config/groups/Targeting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ abstract class Targeting(
5454
private val predicate: () -> Boolean = { true },
5555
private val defaultRange: Double,
5656
private val maxRange: Double,
57-
) : TargetingConfig, SettingGroup(owner, owner.settings.size) {
57+
) : TargetingConfig, SettingGroup(owner) {
5858

5959
/**
6060
* The range within which entities can be targeted. This value is configurable and constrained

0 commit comments

Comments
 (0)