Essentials
Essentials copied to clipboard
Adding msgFormatIn
Information
This PR closes #2012
Details
Proposed feature:
The current msgFormat system doesn't let us modify the chat to make it work in two ways, it only let's us add 1 out and in format which is very inconvenient as shown on the screenshots below.
Environments tested:
OS: Windows 10
Java version: openjdk version "16.0.1" 2021-04-20
~~- [ ] Most recent Paper version (1.XX.Y, git-Paper-BUILD)~~ ~~- [ ] CraftBukkit/Spigot/Paper 1.12.2~~ ~~- [ ] CraftBukkit 1.8.8~~
Demonstration:
This is the problem by using msgFormat (without adding msgFormatOut and msgFormatIn)
But using msgFormatOut and msgFormatIn, we can achieve this:
Credit: I'd like to thank @Evidentsinger14 and @powercasgamer for helping me on this! (thanks to @kev626 aswell for pointing out the msgFormat mistake)
Actually I'm gonna rename msgFormatOut by msgFormat back but keep the msgFormatIn as it would break the format in the lang files with the msgFormat line
I'm not convinced we need to issue a breaking change to our message formats (which would break people's existing locales) as this appears to not even be an issue. The message format has different variables for the parties involved, the first being the sender and the second being the recipient. You're not supposed to hardcode any of the parties so I'm not inclined to support this.
I'm not convinced we need to issue a breaking change to our message formats (which would break people's existing locales) as this appears to not even be an issue. The message format has different variables for the parties involved, the first being the sender and the second being the recipient. You're not supposed to hardcode any of the parties so I'm not inclined to support this.
Yeah I agree with this, many of the chat plugins have this feature so I thought it'd be a good idea to have that implemented, however, this is also the reason why I changed msgFormatOut to msgFormat so that their current format wouldn't be removed, another idea to counter this problem could be that if the user doesn't have msgFormatIn it would take msgFormat and run the format the way essentials does right now and that he could use msgFormatIn to add a 2nd format for Incoming messages, let me know your thoughts on that!
For example if the users lang file only has: msgFormat=\u00A77✉ \u00A77[{0} -> {1}] \u00A7f→ \u00A7f{2}
Then it will use that format the other way around like this: ✉ [Agaloth -> me] → test123 ✉ [me -> Agaloth] → test123
But if the user sets msgFormatIn then it will work as a two way format like this:
msgFormat=\u00A77✉ \u00A77{0} \u00A7fmessaged you \u00A7f→ \u00A7f{2} msgFormatIn=\u00A77✉ \u00A7fYou messaged\u00A77 {1} \u00A7f→ \u00A7f{2}
Which will be something like:
✉ Agaloth messaged you → test123 ✉ You messaged Agaloth → test123
(This is not implemented yet, I'm proposing possible fixes for the current issue)
Sorry for the late reply, but couldn't this entire PR be changed by editing msgFormat
and changing meRecipient
and meSender
Closing due to no reply on the necessity for this change.