30 lines
930 B
Kotlin
30 lines
930 B
Kotlin
package fr.username404.snowygui
|
|
|
|
import fr.username404.snowygui.EventSnowy.Companion.useKey
|
|
import fr.username404.snowygui.config.Configuration.obtained
|
|
import fr.username404.snowygui.misc.AddKeyMaps
|
|
import io.github.config4k.getValue
|
|
import org.apache.logging.log4j.LogManager
|
|
import org.apache.logging.log4j.Logger
|
|
|
|
abstract class Snowy {
|
|
private val displayInitMessage: Boolean by obtained
|
|
companion object {
|
|
fun onEvent(e: String, lambda: argsLambda) = useKey(e).add(lambda)
|
|
@JvmField
|
|
val logs: Logger = LogManager.getLogger()
|
|
}
|
|
private fun eventsInit() {
|
|
onEvent("EndTick") {
|
|
for (Key in AddKeyMaps.list.keys) {
|
|
if (Key.isDown) {
|
|
AddKeyMaps.list[Key]?.invoke()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
fun atInit() {
|
|
if (displayInitMessage) logs.info("Init point of SnowyGUI hit.")
|
|
eventsInit()
|
|
}
|
|
} |