-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Enhanced Format Strings for Component #1144
Comments
We would need to be sure to strip parser tokens from players input too, or maybe by permission check? otherwise players could write parser tokens. |
I am open to PRing this if this is something that the team wants. the parser would need to be converted from kashike's text lib to bungees chat lib which should be easy to do. for more examples of the format, see this file: https://github.com/VoxelGamesLib/VoxelGamesLibv2/blob/master/VoxelGamesLib/src/main/java/com/voxelgameslib/voxelgameslib/lang/LangKey.java#L59 |
I would recommend escaping of special tokens instead of stripping, so no data would be lost. user input should be escaped by default. if a chatplugin decides the user is allowed to use those tokens it can unescape the string or parts of it |
Tokens should be indeed escaped by default. |
just a bit brainstorming here, looking for comments:
|
This is being folded into #4830. |
While the component API is nice for when you can structure your messages in code, the API is not friendly for storing message formats, for solving I18N and the AsyncChatEvent
Adding a new chat event for components is messy and hard to understand (who is priority? how does 2+ plugins even manipulate the format? what if one wants components, then one that wants to be "last" wants text?)
Converting back and forth between every event is sloppy.
I propose we implement a Textual version of components like {click:url:https://google.com}go to google{/click}, that can be part of the legacy>component conversion API
@MiniDigger has a parser here: https://github.com/VoxelGamesLib/VoxelGamesLibv2/blob/master/VoxelGamesLib/src/main/java/com/voxelgameslib/voxelgameslib/lang/LangFormatter.java#L104
This looks to be a great fit if converted.
This enables you to then use this enhanced format strings in any chat message from plugins, enabling you to define them in I18N language files too.
This is also almost required for properly implementing I18N considering what text is modified might vary by language, which is insanely difficult to handle in code.
I suggest settings.enhanced-chat-format: true for config on to use this system.
I propose to the team the default be on, as the syntax used by VGL's parser is extremely unlikely to false positive hit an existing plugins chat messages.
We will need to strip the parser codes in ChatColor.stripColors too.
The text was updated successfully, but these errors were encountered: