Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

Adding msgFormatIn

Open Agaloth opened this issue 3 years ago • 5 comments

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) image

But using msgFormatOut and msgFormatIn, we can achieve this: image

Credit: I'd like to thank @Evidentsinger14 and @powercasgamer for helping me on this! (thanks to @kev626 aswell for pointing out the msgFormat mistake)

Agaloth avatar Jan 24 '22 23:01 Agaloth

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

Agaloth avatar Jan 24 '22 23:01 Agaloth

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.

JRoy avatar Jan 25 '22 23:01 JRoy

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!

Agaloth avatar Jan 26 '22 00:01 Agaloth

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)

Agaloth avatar Jan 26 '22 00:01 Agaloth

Sorry for the late reply, but couldn't this entire PR be changed by editing msgFormat and changing meRecipient and meSender

JRoy avatar Jul 05 '22 16:07 JRoy

Closing due to no reply on the necessity for this change.

JRoy avatar Oct 14 '22 22:10 JRoy