Skip to content

Commit

Permalink
detekt fix
Browse files Browse the repository at this point in the history
  • Loading branch information
makeevrserg committed Jan 20, 2024
1 parent 8868627 commit 2933f6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package ru.astrainteractive.astralibs.command.type


object ArgumentTypeExt {
fun <T : Any> ArgumentType<T?>.withDefault(default: T): ArgumentType<T> {
return ArgumentType { transform(it) ?: default }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ import ru.astrainteractive.klibs.kstorage.api.MutableStorageValue
import ru.astrainteractive.klibs.kstorage.api.StateFlowMutableStorageValue

object BukkitMutableStorageValue {
inline fun <reified T> FileConfiguration.anyStateFlowMutableStorageValue(path: String): StateFlowMutableStorageValue<T?> {
inline fun <reified T> FileConfiguration.anyStateFlowMutableStorageValue(
path: String
): StateFlowMutableStorageValue<T?> {
return StateFlowMutableStorageValue(
default = null,
saveSettingsValue = { set(path, it) },
loadSettingsValue = { getObject(path, T::class.java).takeIf { contains(path) } }
)
}

inline fun <reified T> FileConfiguration.anyMutableStorageValue(path: String): MutableStorageValue<T?> {
inline fun <reified T> FileConfiguration.anyMutableStorageValue(
path: String
): MutableStorageValue<T?> {
return MutableStorageValue(
default = null,
saveSettingsValue = { set(path, it) },
Expand Down

0 comments on commit 2933f6f

Please sign in to comment.