5zig / The-5zig-API

The official client API of The 5zig Mod.
Apache License 2.0
11 stars 2 forks source link

What's the event for when a chat message is received? #7

Closed ghost closed 7 years ago

ghost commented 7 years ago

I've searched this repository for phrases like onChat and can't find the event handler that allows me to receive a chat event.

I can find the ChatEvent class, which I'm guessing is what this method will be passed, but I can't find the method itself.

What @EventHandler method do I have to define in my main function to be able to handle chat events?

5zig commented 7 years ago

It doesn't matter what the method name is, just make sure you use the @EventHandler annotation and the only parameter of your method is ChatEvent.

ghost commented 7 years ago

...really? I'm interested now how that is implemented by the mod, does it just try to find the method with that signature?

Thanks though :)

5zig commented 7 years ago

Yes, exactly. It is all done using reflection and inspired by the event system in Forge and Bukkit.