Aust1n46 / VentureChat

GNU General Public License v3.0
37 stars 47 forks source link

Modify message #37

Closed iGabyTM closed 1 year ago

iGabyTM commented 1 year ago

Since the VentureChatEvent doesn't have any setters, how can I modify the message? I need to replace some characters, and since you cancel AsyncPlayerChatEvent I can't do it there either.

Aust1n46 commented 1 year ago

AsyncPlayerChatEvent is cancelled at priority Highest, which fires last. You can modify the event before it reaches VentureChat by listening on a lower priority.

VentureChatEvent is read only and fires after I've already processed the chat. Modifying the event would invoke modifying the json as well, which is why it's read only. There theoretically could be an event between AsyncPlayerChatEvent and VentureChat event that fires after VentureChat has decided to process the chat (the player isn't muted, etc) but before processing the json.

iGabyTM commented 1 year ago

For some reason my listener with HIGH priority didn't work, thank you for your reply.