From d8231aadfb038c103c55c4cd90137568108a1bd8 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Tue, 11 May 2021 17:07:31 +0200 Subject: [PATCH] Shorten the execAction method --- .../fr/username404/snowygui/gui/elements/ClickButton.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickButton.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickButton.kt index 0df4502..ddbbe25 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickButton.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickButton.kt @@ -23,11 +23,7 @@ class ClickButton( } internal var lightningFactor: Float = 0.33F } - private fun execAction() { - action?.let { - this@ClickButton.it() - } - } + private fun execAction() { action?.invoke(this) } private var wasWithinBounds: Boolean = false var toggled: Boolean = false; private set(value) { if (value) lightUp() else if (field) lightDown()