Essentials
Essentials copied to clipboard
Add support for local and global chats in Discord
This pull request is a draft since it requires #4683 to be merged first.
Information
×
Details
Proposed feature:
This change makes use of added separate events for local and global chats in , making it possible to change the formatting of messages sent from different chat types, as well as disable them altogether (for example, if you don't want to see local chat messages in Discord).
By default Essentials Discord will continue to use Bukkit chat events without any kind of separation, you must explicitly opt in to have new behaviour by changing use-essential-events to true.
Environments tested:
OS: Windows 10 20H2.
Java version:
openjdk version "17" 2021-09-14 LTS
OpenJDK Runtime Environment Zulu17.28+13-CA (build 17+35-LTS)
OpenJDK 64-Bit Server VM Zulu17.28+13-CA (build 17+35-LTS, mixed mode, sharing)
- [x] Most recent Paper version (1.18.1, git-Paper-71)
- [ ] CraftBukkit/Spigot/Paper 1.12.2
- [ ] CraftBukkit 1.8.8
Demonstration:
![Screenshot of the Minecraft chat mirroring to Discord. Brawaru joins the server and says ‘hey’, it gets repeated to Discord as ‘Brawaru: hey’. Brawaru then says ‘now I will enable essentials events’. After enabling them Brawaru says ‘nothing has changed, since local chat is not enabled’, continued ‘I will now enable local chat’. Those messages were repeated to Discord as before. Brawaru then says ‘hello from local chat’, an ‘L’ appears at the beginning of his message, the message gets repeated in Discord as ‘[Local] Brawaru: hello from local chat’. Brawaru then uses question syntax and asks, ‘I am rather looking forward to this analysis, aren't you?’, it gives the message prefix ‘Question’, the same prefix appears in repeated Discord message. Brawaru then shouts ‘Agent Coomer, report to Topside Tactical Operations Center.’, it has ‘Shout’ prefix, the same prefix appears in Discord. In the end Brawaru says ‘now I set message-types.local to “none”, local chat is no longer visible in discord’; which is true and the message doesn't appear in Discord.](https://user-images.githubusercontent.com/10401817/145730615-94195eea-e882-4b9f-897d-049a1fbee6e4.png)
Fixed #4989