-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Discussion
Note that this is a discussion thread, and does not currently indicate any planned features. Instead, it exists to allow people to comment and suggest changes to a particular part of EssentialsX in one consolidated thread.
Summary
Several changes to or a total overhaul of how EssentialsX constructs and sends messages. (To clarify; "messages" means any text sent from the plugin to a user/the console, not private messages.)
Problems with the current system
Currently, EssentialsX stores its messages in several messages[...].properties files. These are accessed with the static I18n.tl method used throughout the plugin, which loads the corresponding message from the default or user-created messages files, substitutes in any required parameters like player names or other translated messages, and returns it ready to be sent out. However, this has some flaws:
- Placeholders use a format that is not particularly descriptive (and feels non-standard)
- You either have to guess what the placeholders do based on then default messages or read the EssentialsX source, both of which can be daunting for server admins and translators.
- PlaceholderAPI isn't supported, and trying to add support was difficult as we needed to change every place a message was used in code just to provide a player to PlaceholderAPI.
Colour codes are currently recorded as\u00a7x, where\u00a7is the § symbol andxis the hexadecimal colour code.If you haven't memorised these colour codes, editing EssentialsX messages becomes a tedious chore.- Update: EssentialsX now uses Crowdin, which alleviates some of the issues with this.
- There is absolutely no way to utilise Minecraft's modern chat features like hover/click events due to a lack of any JSON support.
- This has been requested several times already, but isn't currently very easy to implement without significant changes.
Usage messages can only be controlled viaplugin.yml, not in the standard messages file.These generally use English words, and translating these requires more steps than should be necessary.- Update: As of Add support for translating command description and usage #3284 this has been implemented
Possible improvements
- Allow JSON in messages files.
- This finally gives people the ability to use hover and click events.
- Split messages across several files by category.
- For example, we could have a "usage" file, an "errors" file, a "economy" file etc.
- EssentialsX doesn't need to know where the messages come from as long as they're present.
- Users can alter this structure however they want, and EssentialsX will just load all the files that match the right locale.
- Use a chat component library like md_5's chat API (shipped with Spigot but not CB) or KyoriPowered/text (well-known)
- Picking one of these libraries could make supporting JSON features much easier.
- We would need to shade in the library, as they are not shipped with Bukkit itself.
- These libraries would likely need additional supporting code to allow for more advanced features such as the ones mentioned below.
- PlaceholderAPI support considered from day one.
- PAPI includes supports for hundreds more placeholders than we could implement by ourselves.
- PAPI requires a player to be provided as context, otherwise most expansions won't know what to retrieve placeholders for.
- Support named placeholders in messages files, like
{target}or{location}- These are easier for translators and server admins to understand, compared to the cryptic
{0} {1} {2}littered throughout the messages files. These could be extended to support tiny script-like expressions, like{player is god} -> "true"/"false"or{target afkmessage} -> "getting lunch", thought this likely wouldn't be a priority.- This could even be how we specify which player is used for PAPI placeholders - for example,
{target %luckperms_track%}.
- This could even be how we specify which player is used for PAPI placeholders - for example,
- These are easier for translators and server admins to understand, compared to the cryptic
Concerns
- Lots of servers already have pre-existing custom
messages.propertiesfiles, and EssentialsX has several community translations in this format.- We'd need to either find a way of not breaking compatibility, or automatically migrating these files if we change the format.
This is the write-up of several thoughts I've had over the past few months. Any further suggestions or feedback on EssentialsX is welcome in the replies below.