summaryrefslogtreecommitdiff
path: root/src/main/kotlin/event/UltraNotifierEvents.kt
blob: 7190b6387555b608341fc953b2e4fa432d7ff16f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package moe.nea.ultranotifier.event

import moe.nea.ultranotifier.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
	}

	fun register(obj: SubscriptionTarget) {
//#if FORGE
//$$		eventBus.register(obj)
//#else
		eventBus.subscribe(obj)
//#endif
	}
}