diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/ConfigScreen.kt b/common/src/main/kotlin/fr/username404/snowygui/config/ConfigScreen.kt index cc02761..06bf72a 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/ConfigScreen.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/ConfigScreen.kt @@ -88,10 +88,8 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) { ) } }.setTooltip(TranslatableComponent("$confPrefix.general.macros.tooltip")).setSaveConsumer { it.forEach { string -> - val splitString: Pair? = string.split(":").map { toTrim -> toTrim.trimStart() }.let { element -> - if (element.size == 2) element.component1() to element.component2() else null - }; if (splitString != null) { - Macro(title = splitString.first, command = splitString.second).let { newMacro -> + with(string.split(":")) { + if (size == 2) Macro(title = component1().trimStart(), command = component2().trim()).let { newMacro -> macrosButtons.removeIf { existingMacro -> (existingMacro.title == newMacro.title) || (existingMacro.command == newMacro.command)