transformMessage sender and recipient

Is there an easy way to get both the sender and the recipient of a message while modifying said message in some way? What I am ultimately trying to do is range based chat. Obviously I would simply send an absent optional back to transformMessage or cancel the chatting event, but I’m not sure how to check the range exactly as MessageEvent has only a cause and transformMessage provides only a recipient; sender is always null. I believe I have a convoluted way to do this but am wondering if something simpler is possible.

One way of doing it would be to generate a MessageSink (name might have changed) which contains all MessageRecipients near the sender. Then, you set the event’s MessageSink to that MessageSink.

This may be a bit slow when more players are on, but you could still optimize it using some smart techniques related to player positioning (can’t think of any right now).

Sounds like a MessageChannel. I am using those, but I’m trying to allow various local and non-local channels at the same time. Still, if I made a way to clone the original channel that may just work. Then I could just assign the sending user into the channel for added functionality if I need.

Not sure if that’s the best way, but it may be slightly better than what I had in mind.

Maybe this will help

If MessageSink has indeed been renamed MessageChannel, it would seem you agree. Perhaps it is the best way, but the way transformMessage seems like it should function offers up a tantalizingly simple solution.