From af1e323524accb1b0d1628ffad17da14ece677d6 Mon Sep 17 00:00:00 2001 From: Violet Vibes Date: Mon, 30 Jan 2023 08:54:07 +0100 Subject: [PATCH] Add EscClose plugin --- .../src/main/kotlin/EscClose/plugin.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugin-playground/src/main/kotlin/EscClose/plugin.kt diff --git a/plugin-playground/src/main/kotlin/EscClose/plugin.kt b/plugin-playground/src/main/kotlin/EscClose/plugin.kt new file mode 100644 index 0000000..12489cc --- /dev/null +++ b/plugin-playground/src/main/kotlin/EscClose/plugin.kt @@ -0,0 +1,23 @@ +package EscClose + +import plugin.Plugin +import plugin.annotations.PluginMeta +import plugin.api.API +import java.awt.event.KeyAdapter +import java.awt.event.KeyEvent + +@PluginMeta ( + author = "Chisato", + description = "Allows you to use ESC in order to (safety) close the open interface/dialogue.", + version = 1.0 +) +class plugin : Plugin() { + override fun Init() { + API.AddKeyboardListener(object : KeyAdapter() { + override fun keyPressed(e: KeyEvent) { + if (e.keyCode == KeyEvent.VK_ESCAPE) + API.DispatchCommand("::xface") + } + }) + } +} \ No newline at end of file