-
-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API8 - Improve PlayerChatEvent #2340
Conversation
I've been talking to Faith about this as it's been done and this is a step up from where we were. I do have a couple of thoughts on a slightly different approach and any feedback/thoughts on this would be welcome. For this, the intention is that chat formatters are chained. Would a list of formatters that are then executed in order, rather than chained, be better here. My thought was that plugins could inspect the formatters that other plugins have applied and make decisions based on that, so if I detected a chat router that came from UltimateChat, via some heuristic, for example, I might not want to apply mine at all. It should also be possible for a plugin to clear formatters from this list too That might be complicating it a bit though. I don't mind not doing this, it's just an alternative, but it might not be all the useful. Protection plugins, such as GriefDefender, may only care about the end result of a message. Rather than having to go and execute the chat formatter on every audience manually, is there merit to create a second "post but not post" event after the formatting has been resolved? Something like: interface PlayerChatEvent extends Cancellable {
interface Format extends PlayerChatEvent {
// this would be what we have now
}
interface Formatted extends PlayerChatEvent {
/*
* The Audiences that will recieve a message, and their respective message
*/
Map<Audience, Component> messages();
/*
* Protection plugins could stop certain messages getting through to specific
* audiences
*/
void filter(Audience audience);
}
} Protection plugins etc. that really only care to cancel something may appreciate this. |
9e89248
to
8ecd355
Compare
8ecd355
to
90ab3c7
Compare
SpongeAPI | Sponge
#2259
MessageChannelEvent
.PlayerChatRouter
->PlayerChatFormatter
now only handles message formatting. Which is applied to each audience of aForwardingAudience
PlayerChatEvent
extendsMessageChannelEvent
to handle the audience target replacingPlayerChatRouter