booksaw / BetterTeams

Create teams to fight to be the best (Minecraft Plugin)
https://www.spigotmc.org/resources/better-teams.17129/
MIT License
71 stars 46 forks source link

Add a TeamPreMessageEvent and TeamMessageEvent to the API #492

Closed Harieo closed 1 year ago

Harieo commented 1 year ago

I would like to propose the addition of a TeamPreMessageEvent and TeamMessageEvent to allow third-party developers to more accurately detect, amend and cancel team messages.

This pull request contains the following amendments:

The reason for this change comes from a recent plugin I created relating to a chat filter which was forced to use AsyncPlayerChatEvent and PlayerCommandPreprocessEvent to filter and cancel messages, which was not a perfect solution as you may imagine. These events will make the API a lot more future-proof by providing supported events for chat messages rather than having to find workarounds which could be rendered useless if a major plugin update happened.

Happy to hear your thoughts on the new code!