Skip to content

Commit 78ebb6b

Browse files
committed
Fixed for good
1 parent 1a4d86b commit 78ebb6b

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/main/kotlin/com/lambda/config/Configurable.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.lambda.config.settings.CharSetting
2525
import com.lambda.config.settings.FunctionSetting
2626
import com.lambda.config.settings.StringSetting
2727
import com.lambda.config.settings.collections.BlockCollectionSetting
28+
import com.lambda.config.settings.collections.ClassCollectionSetting
2829
import com.lambda.config.settings.collections.CollectionSetting
2930
import com.lambda.config.settings.collections.ItemCollectionSetting
3031
import com.lambda.config.settings.collections.MapSetting
@@ -154,7 +155,7 @@ abstract class Configurable(
154155
visibility,
155156
).register()
156157

157-
inline fun <reified T : Any> setting(
158+
inline fun <reified T : Comparable<T>> setting(
158159
name: String,
159160
immutableList: Collection<T>,
160161
defaultValue: Collection<T> = immutableList,
@@ -169,6 +170,20 @@ abstract class Configurable(
169170
visibility,
170171
).register()
171172

173+
inline fun <reified T : Any> setting(
174+
name: String,
175+
immutableList: Collection<T>,
176+
defaultValue: Collection<T> = immutableList,
177+
description: String = "",
178+
noinline visibility: () -> Boolean = { true },
179+
) = ClassCollectionSetting(
180+
name,
181+
immutableList,
182+
defaultValue.toMutableList(),
183+
description,
184+
visibility,
185+
).register()
186+
172187
// ToDo: Actually implement maps
173188
inline fun <reified K : Any, reified V : Any> setting(
174189
name: String,

src/main/kotlin/com/lambda/config/Configuration.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ abstract class Configuration : Jsonable, Loadable {
136136
info(message)
137137
}
138138
.onFailure { primaryError ->
139-
throw primaryError
140139
LOG.error(primaryError)
141140

142141
runCatching { load(backup) }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class PlaceSettings(
3434
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces").group(baseGroup).index()
3535
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") { airPlace.isEnabled }.group(baseGroup).index()
3636
override val sorter by c.setting("Place Sorter", ActionConfig.SortMode.Tool, "The order in which placements are performed").group(baseGroup).index()
37-
override val tickStageMask by c.setting("Place Stage mask", ALL_STAGES.toSet(), setOf(TickEvent.Input.Post), description = "The sub-tick timing at which place actions are performed").group(baseGroup).index()
37+
override val tickStageMask by c.setting("Place Stage Mask", ALL_STAGES.toSet(), setOf(TickEvent.Input.Post), description = "The sub-tick timing at which place actions are performed").group(baseGroup).index()
3838
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation").group(baseGroup).index()
3939
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements").group(baseGroup).index()
4040
override val placementsPerTick by c.setting("Places Per Tick", 1, 1..30, 1, "Maximum instant block places per tick").group(baseGroup).index()

0 commit comments

Comments
 (0)