Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Nov 10, 2023
1 parent 21bb248 commit 6fc9986
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,15 @@ class MessageConfig : SelfSavable<CommentedConfigurationNode>, KoinComponent {

private fun zeroToOne(): ConfigurationTransformation = ConfigurationTransformation.chain(
ConfigurationTransformation.builder().addAction(path("interval-time-amount"), TransformAction.rename("interval-time")).build(),
ConfigurationTransformation.builder().addAction(path("interval-time"), TransformAction { path, value ->
val oldUnit = value.parent()?.node("interval-time-unit")?.get<TimeUnit>() ?: TimeUnit.MINUTES
val oldNum = value.string ?: "3"
value.set("$oldNum ${oldUnit.name.lowercase()}")
return@TransformAction null
}).build(),
ConfigurationTransformation.builder().addAction(
path("interval-time"),
TransformAction { path, value ->
val oldUnit = value.parent()?.node("interval-time-unit")?.get<TimeUnit>() ?: TimeUnit.MINUTES
val oldNum = value.string ?: "3"
value.set("$oldNum ${oldUnit.name.lowercase()}")
return@TransformAction null
}
).build(),
ConfigurationTransformation.builder().addAction(path("interval-time-unit"), TransformAction.remove()).build()
)

Expand Down

0 comments on commit 6fc9986

Please sign in to comment.