diff --git a/src/main/kotlin/info/opensigma/bind/BindManager.kt b/src/main/kotlin/info/opensigma/bind/BindManager.kt index d589659..1932ede 100644 --- a/src/main/kotlin/info/opensigma/bind/BindManager.kt +++ b/src/main/kotlin/info/opensigma/bind/BindManager.kt @@ -1,6 +1,8 @@ package info.opensigma.bind import info.opensigma.OpenSigma +import info.opensigma.event.impl.KeyPressEvent +import meteordevelopment.orbit.EventHandler import java.util.HashMap import java.util.function.Supplier @@ -15,5 +17,19 @@ class BindManager { map[integer] = runnable } - companion object + @Suppress("unused") + @EventHandler + private fun onKey(keyPressEvent: KeyPressEvent) { + if (keyPressEvent.keyAction != 0) + return + map.forEach { (key, value) -> + if (key.get() == keyPressEvent.key) + value.run() + } + } + + companion object { + @Suppress("unused") + val instance = BindManager() + } } \ No newline at end of file