summaryrefslogtreecommitdiff
path: root/src/main/kotlin/event
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/event')
-rw-r--r--src/main/kotlin/event/TickEvent.kt6
-rw-r--r--src/main/kotlin/event/UltraEvent.kt2
-rw-r--r--src/main/kotlin/event/UltraNotifierEvents.kt5
3 files changed, 9 insertions, 4 deletions
diff --git a/src/main/kotlin/event/TickEvent.kt b/src/main/kotlin/event/TickEvent.kt
index 8643261..4bd2c6c 100644
--- a/src/main/kotlin/event/TickEvent.kt
+++ b/src/main/kotlin/event/TickEvent.kt
@@ -4,10 +4,10 @@ package moe.nea.ultranotifier.event
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
//#endif
-class TickEvent : UltraEvent() {
+class TickEvent : UltraEvent(), UltraEvent.Silent<TickEvent> {
- companion object {
- init {
+ companion object : SubscriptionTarget {
+ override fun init() {
//#if FABRIC
ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick {
TickEvent().post()
diff --git a/src/main/kotlin/event/UltraEvent.kt b/src/main/kotlin/event/UltraEvent.kt
index 4f615c1..80f63fc 100644
--- a/src/main/kotlin/event/UltraEvent.kt
+++ b/src/main/kotlin/event/UltraEvent.kt
@@ -7,6 +7,8 @@ abstract class UltraEvent :
me.bush.eventbus.event.Event()
//#endif
{
+ interface Silent<T> where T : Silent<T>, T : UltraEvent
+
//#if FORGE
//$$ override fun isCancelable(): Boolean {
//$$ return this.isCancellable()
diff --git a/src/main/kotlin/event/UltraNotifierEvents.kt b/src/main/kotlin/event/UltraNotifierEvents.kt
index 7190b63..9c1e1ee 100644
--- a/src/main/kotlin/event/UltraNotifierEvents.kt
+++ b/src/main/kotlin/event/UltraNotifierEvents.kt
@@ -9,9 +9,12 @@ object UltraNotifierEvents {
//#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")
+ if (event !is UltraEvent.Silent<*>) {
+ UltraNotifier.logger.info("Posting $event")
+ }
eventBus.post(event)
return event
}