blob: eb0d71fa5a2867c54a0e3c207862fa3b2b5b453e (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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()
|