diff options
author | Linnea Gräf <nea@nea.moe> | 2024-05-21 21:17:41 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-05-21 21:17:41 +0200 |
commit | f25b818d9d41e2bb3969399cfc8bbff976b5aad7 (patch) | |
tree | 5f9137b374dfca42f596851c85116c9da181fa50 /src/main/kotlin/UltraNotifierEvents.kt | |
download | ultra-notifier-f25b818d9d41e2bb3969399cfc8bbff976b5aad7.tar.gz ultra-notifier-f25b818d9d41e2bb3969399cfc8bbff976b5aad7.tar.bz2 ultra-notifier-f25b818d9d41e2bb3969399cfc8bbff976b5aad7.zip |
Init
Diffstat (limited to 'src/main/kotlin/UltraNotifierEvents.kt')
-rw-r--r-- | src/main/kotlin/UltraNotifierEvents.kt | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/main/kotlin/UltraNotifierEvents.kt b/src/main/kotlin/UltraNotifierEvents.kt new file mode 100644 index 0000000..eb0d71f --- /dev/null +++ b/src/main/kotlin/UltraNotifierEvents.kt @@ -0,0 +1,53 @@ +package moe.nea.ultranotifier + +object UltraNotifierEvents { + val eventBus = +//#if FORGE +//$$ net.minecraftforge.common.MinecraftForge.EVENT_BUS +//#else + me.bush.eventbus.bus.EventBus { UltraNotifier.logger.warn("EventBus: $it") } +//#endif + @JvmStatic + fun <T : UltraEvent> post(event: T): T { + UltraNotifier.logger.info("Posting $event") + eventBus.post(event) + return event + } +} + +abstract class UltraEvent : +//#if FORGE +//$$ net.minecraftforge.fml.common.eventhandler.Event() +//#else + me.bush.eventbus.event.Event() +//#endif +{ +//#if FORGE +//$$ override fun isCancelable(): Boolean { +//$$ return this.isCancellable() +//$$ } +//$$ fun isCancelled(): Boolean { +//$$ return isCanceled() +//$$ } +//$$ fun setCancelled(value: Boolean) { +//$$ setCanceled(value) +//$$ } +//#else + override +//#endif + + fun isCancellable(): Boolean { + return true + } + +//#if FORGE == 0 + override +//#endif + fun cancel() { + setCancelled(true) + } + +} + + +class ChatLineAddedEvent() : UltraEvent() |